mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
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:
1 parent
886642c1a4
commit
1716cf392f
17 files changed
+77
-100
No files matched your search
@@ -202,8 +202,6 @@ export interface AIServiceConfigDisplay {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
customModels?: Array<{ id: string; name: string }>
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
@@ -721,8 +719,6 @@ export const llmApi = {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
customModels?: Array<{ id: string; name: string }>
|
||||
}): Promise<{ success: boolean; config?: AIServiceConfigDisplay; error?: string }> => {
|
||||
return ipcRenderer.invoke('llm:addConfig', config)
|
||||
@@ -741,8 +737,6 @@ export const llmApi = {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
customModels?: Array<{ id: string; name: string }>
|
||||
}
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
|
||||
Vendored
-6
@@ -559,8 +559,6 @@ interface AIServiceConfigDisplay {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
}
|
||||
@@ -620,8 +618,6 @@ interface LlmApi {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
customModels?: Array<{ id: string; name: string }>
|
||||
}) => Promise<{ success: boolean; config?: AIServiceConfigDisplay; error?: string }>
|
||||
updateConfig: (
|
||||
@@ -634,8 +630,6 @@ interface LlmApi {
|
||||
baseUrl?: string
|
||||
maxTokens?: number
|
||||
apiFormat?: string
|
||||
disableThinking?: boolean
|
||||
isReasoningModel?: boolean
|
||||
customModels?: Array<{ id: string; name: string }>
|
||||
}
|
||||
) => Promise<{ success: boolean; error?: string }>
|
||||
|
||||
Reference in new issue
Block a user