RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix chat bot reasoning in GO (#19641)
qinling0210183bed69ded4
diff --git a/internal/service/bot.go b/internal/service/bot.goindex d6de91e68f..77ec28846b 100644--- a/internal/service/bot.go+++ b/internal/service/bot.go@@ -273,9 +273,11 @@ type ChatbotCompletionRequest struct {// python bot_api.py defaults it to False for chatbot// completions, so the service layer mirrors that.Quote *bool `json:"quote"`- // Reasoning / Internet arrive as bool OR 0/1 number depending- // on the widget; the service layer normalises them before- // handing them to the chat pipeline.+ // Reasoning / Internet arrive as bool OR 0/1 number depending on the+ // widget. Internet is normalised by normalizeInternetFlag before reaching+ // the pipeline (chat_pipeline.go); Reasoning is passed through verbatim as+ // the 0..4 agentic-RAG level so medium/high/ultra levels are not collapsed+ // to a bool — resolveReasoningLevel reads it directly.Reasoning any `json:"reasoning"`Internet any `json:"internet"`// DocIDs is an optional comma-separated document filter,diff --git a/internal/service/bot_completion.go b/internal/service/bot_completion.goindex 44e6e3fc34..4f9b0db2a3 100644--- a/internal/service/bot_completion.go+++ b/internal/service/bot_completion.go@@ -412,8 +412,16 @@ func (s *BotService) ChatbotCompletion(kwargs := map[string]interface{}{"quote": req.Quote != nil && *req.Quote,}- if reasoning, ok := normalizeBotBoolFlag(req.Reasoning); ok {- kwargs["reasoning"] = reasoning+ // Pass the raw reasoning level (0..4) straight through to the pipeline.+ // The previous normalizeBotBoolFlag coercion only accepted a bool or 0/1,+ // silently dropping medium/high/ultra agentic-RAG levels (2/3/4) so the+ // new-tab/embed chat fell back to plain RAG. resolveReasoningLevel+ // (chat_pipeline.go) reads this value first and tolerates float64/int/bool/+ // string/json.Number via asInt64, then falls back to the dialog's+ // prompt_config when the key is absent — so omitting it keeps the old+ // default behaviour.+ if req.Reasoning != nil {+ kwargs["reasoning"] = req.Reasoning}if req.Internet != nil {kwargs["internet"] = req.Internet