Skip to content

Commit

Permalink
fix: get correct request when from openai messages to record models
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Apr 1, 2024
1 parent 1f07734 commit 4715650
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apis/record/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ func (messages OpenAIMessages) BuildRecordModels() (models RecordModels, request
if err != nil {
return nil, "", err
}
models = make(RecordModels, len(messages)/2)
models = make(RecordModels, 0, len(messages)/2)
for i := 0; i < len(messages)-1; i += 2 {
models[i/2] = RecordModel{
models = append(models, RecordModel{
Request: messages[i].Content,
Response: messages[i+1].Content,
}
})
}
request = models[len(models)-1].Request
request = messages[len(messages)-1].Content
return models, request, nil
}

Expand Down

0 comments on commit 4715650

Please sign in to comment.