refactor(ai): replace manual reasoning switches with auto-inference

Remove the "Reasoning Model" and "Disable Thinking Mode" toggles from
the model config dialog. These switches were injecting `enable_thinking`
(a Qwen/DashScope-specific request parameter) into all providers,
causing 400 errors on OpenAI, Anthropic, Gemini, and other official
services.

Replace with automatic inference in buildPiModel:
- reasoning: true when the model's catalog capabilities include
  'reasoning'; falls back to a model-name heuristic for unlisted
  custom/self-hosted models (qwen3, qwq, deepseek-r, o1/o3, etc.).
- compat.thinkingFormat 'qwen': only set when reasoning is true AND
  the model is from the qwen provider or the model id contains
  "qwen"/"qwq". All other providers get compat: undefined and will
  never receive enable_thinking.

This means official reasoning models (o3, deepseek-reasoner, etc.) now
automatically get thinkingLevel:'medium', and self-hosted Qwen3
models continue to work as before — without any manual toggle.

Behavior change: models with 'reasoning' in their catalog capabilities
now default to thinkingLevel:'medium' (previously always 'off' unless
the manual switch was enabled).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
diguaandClaude Opus 4.8 committed 2026-05-31 10:28:29 +08:00
1 parent 886642c1a4
commit 1716cf392f
17 files changed
+77 -100

No files matched your search

-2
View File
@@ -25,8 +25,6 @@ export interface AIServiceConfig {
baseUrl?: string
maxTokens?: number
apiFormat?: string
disableThinking?: boolean
isReasoningModel?: boolean
customModels?: Array<{ id: string; name: string }>
authProfile?: string
}
-4
View File
@@ -267,8 +267,6 @@ export function registerAiRoutes(
baseUrl?: string
maxTokens?: number
apiFormat?: string
disableThinking?: boolean
isReasoningModel?: boolean
customModels?: Array<{ id: string; name: string }>
}
}>('/_web/ai/llm/configs', async (request) => {
@@ -286,8 +284,6 @@ export function registerAiRoutes(
baseUrl?: string
maxTokens?: number
apiFormat?: string
disableThinking?: boolean
isReasoningModel?: boolean
customModels?: Array<{ id: string; name: string }>
}
}>('/_web/ai/llm/configs/:id', async (request) => {