From 9859743f8549a404f39fddc19ecfbd974b7b5e35 Mon Sep 17 00:00:00 2001 From: YuanShiJiLoong <2450829984@qq.com> Date: Wed, 25 Feb 2026 03:05:10 +0900 Subject: [PATCH] feat: add reasoning effort setting for Responses API (low/medium/high/xhigh) --- app/api/ai/responses/route.js | 7 ++++++- app/components/SettingsPanel.js | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/api/ai/responses/route.js b/app/api/ai/responses/route.js index 3b0e444..bcc06cf 100644 --- a/app/api/ai/responses/route.js +++ b/app/api/ai/responses/route.js @@ -27,10 +27,15 @@ export async function POST(request) { { role: 'developer', content: systemPrompt }, { role: 'user', content: userPrompt }, ], - max_output_tokens: maxTokens || 4096, stream: true, }; + // 添加思考等级(默认 medium) + const effort = apiConfig?.reasoningEffort || 'medium'; + if (['low', 'medium', 'high', 'xhigh'].includes(effort)) { + requestBody.reasoning = { effort, summary: 'auto' }; + } + const response = await fetch(url, { method: 'POST', headers: { diff --git a/app/components/SettingsPanel.js b/app/components/SettingsPanel.js index 5e153cf..752425f 100644 --- a/app/components/SettingsPanel.js +++ b/app/components/SettingsPanel.js @@ -608,6 +608,22 @@ function ApiConfigForm({ data, onChange }) { {t('apiConfig.geminiNativeHint')} )} + {data.provider === 'openai-responses' && ( +
+ +
+ {[ + { key: 'low', label: 'low' }, + { key: 'medium', label: 'medium' }, + { key: 'high', label: 'high' }, + { key: 'xhigh', label: 'xhigh' }, + ].map(opt => ( + + ))} +
+
控制模型推理深度,默认 Medium,XHigh 质量最高但更慢
+
+ )} update('apiKey', v)} placeholder={t('apiConfig.apiKeyPlaceholder')} secret />