Skip to content

Commit

Permalink
fix: fix sparkdesk function call
Browse files Browse the repository at this point in the history
  • Loading branch information
shijilin0116 authored Jun 20, 2024
1 parent 279caf8 commit ff196b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion relay/adaptor/xunfei/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion relay/adaptor/xunfei/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ff196b7

Please sign in to comment.