From 49c24d8bce5bb20df25cc52be18849c160e8243d Mon Sep 17 00:00:00 2001 From: Haruko386 Date: Tue, 4 Aug 2026 18:00:37 +0800 Subject: [PATCH] fix: unable to control enable think in chat (#17785) --- internal/handler/chat_session.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/handler/chat_session.go b/internal/handler/chat_session.go index 9a31718154..a75a1bc509 100644 --- a/internal/handler/chat_session.go +++ b/internal/handler/chat_session.go @@ -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 }