if an openai message has content and multicontent, fix it before passing it off to the api
This commit is contained in:
parent
b8dc1d1a96
commit
c4f4f6abe6
10
openai.go
10
openai.go
@ -43,6 +43,16 @@ func (o openai) requestToOpenAIRequest(request Request) oai.ChatCompletionReques
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// openai does not allow Content and MultiContent to be set at the same time, so we need to check
|
||||||
|
if len(m.MultiContent) > 0 && m.Content != "" {
|
||||||
|
m.MultiContent = append([]oai.ChatMessagePart{{
|
||||||
|
Type: "text",
|
||||||
|
Text: m.Content,
|
||||||
|
}}, m.MultiContent...)
|
||||||
|
|
||||||
|
m.Content = ""
|
||||||
|
}
|
||||||
|
|
||||||
res.Messages = append(res.Messages, m)
|
res.Messages = append(res.Messages, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user