From 82e4697afe73e5c036a88cea6ff4b675aab4ca63 Mon Sep 17 00:00:00 2001 From: AmintaCCCP Date: Wed, 13 May 2026 17:30:58 +0800 Subject: [PATCH] fix: disable thinking chain for Xiaomi MiMo models - Add isMiMoModel() method to detect Xiaomi MiMo models - Add thinking: { type: 'disabled' } to request body for MiMo models - Fixes issue #127 where reasoning_content was displayed instead of final result - Does not affect other models (DeepSeek, OpenAI, Claude, Gemini) --- src/services/aiService.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/services/aiService.ts b/src/services/aiService.ts index 253f9a1..2b9f37f 100644 --- a/src/services/aiService.ts +++ b/src/services/aiService.ts @@ -79,6 +79,10 @@ export class AIService { return this.getApiType() === 'openai' && this.config.model.trim() === 'deepseek-reasoner'; } + private isMiMoModel(): boolean { + return this.config.model.trim().toLowerCase().includes('mimo'); + } + private async requestText(options: { system: string; user: string; @@ -97,6 +101,7 @@ export class AIService { { role: 'user', content: options.user }, ]; const isDeepSeekReasoner = this.isDeepSeekReasonerModel(); + const isMiMoModel = this.isMiMoModel(); const requestBody = apiType === 'openai-responses' ? { @@ -105,6 +110,7 @@ export class AIService { temperature: options.temperature, max_output_tokens: options.maxTokens, ...(reasoning ? { reasoning } : {}), + ...(isMiMoModel ? { thinking: { type: 'disabled' } } : {}), } : { model: this.config.model, @@ -112,6 +118,7 @@ export class AIService { max_tokens: options.maxTokens, ...(!isDeepSeekReasoner ? { temperature: options.temperature } : {}), ...(!isDeepSeekReasoner && reasoning && apiType !== 'openai-compatible' ? { reasoning } : {}), + ...(isMiMoModel ? { thinking: { type: 'disabled' } } : {}), }; let data: Record;