Skip to content

Commit

Permalink
fix bug: set model from ask request
Browse files Browse the repository at this point in the history
  • Loading branch information
reminia committed Nov 29, 2023
1 parent 063669f commit 96ba876
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ func OpenAiProxy(callback func(c *gin.Context) ResponseCallBack) gin.HandlerFunc
req.Host = ""
req.Header.Set("Authorization", "Bearer "+OPENAI_KEY)
req.Header.Set("Content-Type", "application/json")
var data Ask
err = c.ShouldBindJSON(&data)
var ask Ask
err = c.ShouldBindJSON(&ask)
if err != nil {
panic(err)
}
data.setDefault()
ask.setDefault()
body := OpenAiRequest{
Model: OPENAI_MODEL,
Model: ask.Model,
Temperature: OPENAI_TEMPERATURE,
}
msg := Message{
Role: "user",
Content: data.Content,
Content: ask.Content,
}
body.Messages = []Message{systemMsg(data.Lang), msg}
body.Messages = []Message{systemMsg(ask.Lang), msg}
var length int
req.Body, length = newRequestBody(body)
req.ContentLength = int64(length)
Expand Down

0 comments on commit 96ba876

Please sign in to comment.