fix: fix sparkdesk function call

This commit is contained in:
Shi Jilin 2024-06-20 22:56:59 +08:00 committed by GitHub
parent 279caf82dc
commit ff196b75a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -45,8 +45,12 @@ func requestOpenAI2Xunfei(request model.GeneralOpenAIRequest, xunfeiAppId string
xunfeiRequest.Payload.Message.Text = messages
if strings.HasPrefix(domain, "generalv3") {
functions := make([]model.Function, len(request.Tools))
for i, tool := range request.Tools {
functions[i] = tool.Function
}
xunfeiRequest.Payload.Functions = &Functions{
Text: request.Tools,
Text: functions,
}
}

View File

@ -10,7 +10,7 @@ type Message struct {
}
type Functions struct {
Text []model.Tool `json:"text,omitempty"`
Text []model.Function `json:"text,omitempty"`
}
type ChatRequest struct {