🐛 fix: function call error (#190)

This commit is contained in:
MartialBE
2024-05-19 13:11:46 +08:00
parent 68e5cf1183
commit c04dfc735f
6 changed files with 54 additions and 8 deletions

View File

@@ -111,6 +111,21 @@ func (m ChatCompletionMessage) ParseContent() []ChatMessagePart {
return nil
}
func (m *ChatCompletionMessage) FuncToToolCalls() {
if m.ToolCalls != nil {
return
}
if m.FunctionCall != nil {
m.ToolCalls = []*ChatCompletionToolCalls{
{
Type: ChatMessageRoleFunction,
Function: m.FunctionCall,
},
}
m.FunctionCall = nil
}
}
type ChatMessageImageURL struct {
URL string `json:"url,omitempty"`
Detail string `json:"detail,omitempty"`