Skip to content

Commit

Permalink
no chat files (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho authored Jun 18, 2024
1 parent 884260a commit 2ec6d5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/llm_openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func messagesToOpenAIMesages(messages []models.Message, chatFiles []sqlc_queries
open_ai_msgs := lo.Map(messages, func(m models.Message, _ int) openai.ChatCompletionMessage {
return openai.ChatCompletionMessage{Role: m.Role, Content: m.Content}
})
if len(chatFiles) == 0 {
return open_ai_msgs
}
parts := lo.Map(chatFiles, func(m sqlc_queries.ChatFile, _ int) openai.ChatMessagePart {
if SupportedMimeTypes().Contains(m.MimeType) {
return openai.ChatMessagePart{
Expand Down

0 comments on commit 2ec6d5d

Please sign in to comment.