From b095a5511aac9fc9ca9d0734dc5c07c5c5772106 Mon Sep 17 00:00:00 2001 From: euvre <93761161+euvre@users.noreply.github.com> Date: Thu, 23 Jul 2026 11:14:08 +0800 Subject: [PATCH] fix: make qwen3-vl-plus usable as chat/vision model in Go mode (#17254) --- conf/models/aliyun.json | 10 +++++++--- conf/models/qiniu.json | 2 +- internal/entity/models/aliyun.go | 25 +++++++++++++++++++++++++ web/src/hooks/use-document-request.ts | 1 - 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/conf/models/aliyun.json b/conf/models/aliyun.json index 7511f28c38..d003907656 100644 --- a/conf/models/aliyun.json +++ b/conf/models/aliyun.json @@ -32,10 +32,14 @@ }, { "name": "qwen3-vl-plus", - "max_tokens": 260096, + "max_tokens": 256000, "model_types": [ - "vision" - ] + "vision", + "chat" + ], + "tools": { + "support": true + } }, { "name": "qwen-tts-flash", diff --git a/conf/models/qiniu.json b/conf/models/qiniu.json index ab4f2b485b..0e0b18eac5 100644 --- a/conf/models/qiniu.json +++ b/conf/models/qiniu.json @@ -551,4 +551,4 @@ } } ] -} \ No newline at end of file +} diff --git a/internal/entity/models/aliyun.go b/internal/entity/models/aliyun.go index 80292015ed..6dd2cbb7f2 100644 --- a/internal/entity/models/aliyun.go +++ b/internal/entity/models/aliyun.go @@ -112,6 +112,11 @@ func (a *AliyunModel) ChatWithMessages(ctx context.Context, modelName string, me } } + // For qwen3 models on DashScope, enable_thinking defaults to true when + // omitted. RAGFlow's default is to disable thinking unless explicitly + // enabled by the user, matching Python's chat_model.py behavior. + applyQwen3ThinkingDefault(modelName, reqBody) + jsonData, err := json.Marshal(reqBody) if err != nil { return nil, fmt.Errorf("failed to marshal request: %w", err) @@ -253,6 +258,11 @@ func (a *AliyunModel) ChatStreamlyWithSender(ctx context.Context, modelName stri } } + // For qwen3 models on DashScope, enable_thinking defaults to true when + // omitted. RAGFlow's default is to disable thinking unless explicitly + // enabled by the user, matching Python's chat_model.py behavior. + applyQwen3ThinkingDefault(modelName, reqBody) + jsonData, err := json.Marshal(reqBody) if err != nil { return fmt.Errorf("failed to marshal request: %w", err) @@ -337,6 +347,21 @@ func (a *AliyunModel) ChatStreamlyWithSender(ctx context.Context, modelName stri return sender(&endOfStream, nil) } +// applyQwen3ThinkingDefault ensures enable_thinking=false is sent for qwen3 +// models when it hasn't been explicitly configured. DashScope defaults +// enable_thinking to true for qwen3 models, which produces reasoning output +// that RAGFlow doesn't expect in most pipelines. Mirrors Python's +// chat_model.py default of enable_thinking=False for qwen3. +func applyQwen3ThinkingDefault(modelName string, reqBody map[string]interface{}) { + if !strings.Contains(strings.ToLower(modelName), "qwen3") { + return + } + if _, alreadySet := reqBody["enable_thinking"]; alreadySet { + return + } + reqBody["enable_thinking"] = false +} + // aliyunToolChoice prevents qwen-flash from repeatedly issuing another tool call // after a tool result has already been supplied. With "auto", qwen-flash can // keep emitting tool_calls even for a successful result until the ReAct graph diff --git a/web/src/hooks/use-document-request.ts b/web/src/hooks/use-document-request.ts index 63af8acd37..c21fea03e6 100644 --- a/web/src/hooks/use-document-request.ts +++ b/web/src/hooks/use-document-request.ts @@ -538,7 +538,6 @@ export const useSetDocumentPipelineParser = () => { parser_id: parserId, pipeline_id: pipelineId, }; - if (parserConfig) { updateData.parser_config = isPipelineParserConfig(parserConfig)