fix: unable to control enable think in chat (#17785)

This commit is contained in:
Haruko386
2026-08-04 18:00:37 +08:00
committed by GitHub
parent 4d997bc740
commit 49c24d8bce

View File

@@ -131,6 +131,7 @@ type ChatCompletionsRequest struct {
StoreHistory *bool `json:"store_history,omitempty"`
Legacy bool `json:"legacy,omitempty"`
Stream *bool `json:"stream"`
Thinking string `json:"thinking"`
Temperature *float64 `json:"temperature,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
@@ -182,6 +183,15 @@ func (h *ChatSessionHandler) ChatCompletions(c *gin.Context) {
// Build generation config
genConfig := make(map[string]interface{})
if req.Thinking != "" {
switch req.Thinking {
case "enabled":
genConfig["thinking"] = true
case "disabled":
genConfig["thinking"] = false
case "", "default":
}
}
if req.Temperature != nil {
genConfig["temperature"] = *req.Temperature
}