Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

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

Haruko38649c24d8bce5b
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
}