fix: update OpenAI request fields to use json.RawMessage for dynamic data handling

This commit is contained in:
CaIon
2026-03-06 19:10:37 +08:00
parent 9905599d27
commit fb76abb329
6 changed files with 34 additions and 25 deletions

View File

@@ -17,7 +17,7 @@ type CozeEnterMessage struct {
type CozeChatRequest struct {
BotId string `json:"bot_id"`
UserId string `json:"user_id"`
UserId json.RawMessage `json:"user_id"`
AdditionalMessages []CozeEnterMessage `json:"additional_messages,omitempty"`
Stream bool `json:"stream,omitempty"`
CustomVariables json.RawMessage `json:"custom_variables,omitempty"`

View File

@@ -34,8 +34,8 @@ func convertCozeChatRequest(c *gin.Context, request dto.GeneralOpenAIRequest) *C
}
}
user := request.User
if user == "" {
user = helper.GetResponseID(c)
if len(user) == 0 {
user = json.RawMessage(helper.GetResponseID(c))
}
cozeRequest := &CozeChatRequest{
BotId: c.GetString("bot_id"),