Skip to content

Commit

Permalink
fix: fix xunfei panic error (close songquanpeng#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng authored and dirname committed Dec 22, 2023
1 parent e7d0a18 commit ce83d78
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion controller/relay-xunfei.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,13 @@ func xunfeiHandler(c *gin.Context, textRequest GeneralOpenAIRequest, appId strin
case stop = <-stopChan:
}
}

if len(xunfeiResponse.Payload.Choices.Text) == 0 {
xunfeiResponse.Payload.Choices.Text = []XunfeiChatResponseTextItem{
{
Content: "",
},
}
}
xunfeiResponse.Payload.Choices.Text[0].Content = content

response := responseXunfei2OpenAI(&xunfeiResponse)
Expand Down

0 comments on commit ce83d78

Please sign in to comment.