diff --git a/.i18nrc.js b/.i18nrc.js index 58c01941df..6f78936852 100644 --- a/.i18nrc.js +++ b/.i18nrc.js @@ -25,7 +25,7 @@ module.exports = defineConfig({ ], temperature: 0, saveImmediately: true, - modelName: 'gpt-4.1-mini', + modelName: 'gpt-5-mini', experimental: { jsonMode: true, }, diff --git a/locales/ar/chat.json b/locales/ar/chat.json index 77ac818caa..1ea1982a34 100644 --- a/locales/ar/chat.json +++ b/locales/ar/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "شدة الاستدلال" }, + "textVerbosity": { + "title": "مستوى تفصيل المخرجات النصية" + }, "thinking": { "title": "مفتاح التفكير العميق" }, diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.json index 144dc93477..6fab0fc27b 100644 --- a/locales/bg-BG/chat.json +++ b/locales/bg-BG/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Интензитет на разсъждение" }, + "textVerbosity": { + "title": "Ниво на подробност на изходния текст" + }, "thinking": { "title": "Превключвател за дълбоко мислене" }, diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.json index dad3fc9a2f..1303221a10 100644 --- a/locales/de-DE/chat.json +++ b/locales/de-DE/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Argumentationsstärke" }, + "textVerbosity": { + "title": "Detaillierungsgrad des Ausgabetextes" + }, "thinking": { "title": "Tiefdenk-Schalter" }, diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json index f5a0a62ad8..d2eb61a96a 100644 --- a/locales/en-US/chat.json +++ b/locales/en-US/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Reasoning Intensity" }, + "textVerbosity": { + "title": "Output Text Detail Level" + }, "thinking": { "title": "Deep Thinking Switch" }, diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.json index b61056c42a..addc387e39 100644 --- a/locales/es-ES/chat.json +++ b/locales/es-ES/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Intensidad de razonamiento" }, + "textVerbosity": { + "title": "Nivel de detalle del texto de salida" + }, "thinking": { "title": "Interruptor de pensamiento profundo" }, diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.json index 83bd4be41c..3649667c02 100644 --- a/locales/fa-IR/chat.json +++ b/locales/fa-IR/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "شدت استدلال" }, + "textVerbosity": { + "title": "سطح جزئیات متن خروجی" + }, "thinking": { "title": "کلید تفکر عمیق" }, diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.json index fa1e6a9f84..e3103c56e4 100644 --- a/locales/fr-FR/chat.json +++ b/locales/fr-FR/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Intensité du raisonnement" }, + "textVerbosity": { + "title": "Niveau de détail du texte de sortie" + }, "thinking": { "title": "Interrupteur de réflexion approfondie" }, diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.json index 98a6571964..3add1b34a6 100644 --- a/locales/it-IT/chat.json +++ b/locales/it-IT/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Intensità del ragionamento" }, + "textVerbosity": { + "title": "Livello di dettaglio dell'output testuale" + }, "thinking": { "title": "Interruttore di pensiero profondo" }, diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.json index 01eecb92bd..c06573b3c0 100644 --- a/locales/ja-JP/chat.json +++ b/locales/ja-JP/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "推論の強度" }, + "textVerbosity": { + "title": "出力テキストの詳細レベル" + }, "thinking": { "title": "深い思考のスイッチ" }, diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.json index 921db3f371..61a3cbc34c 100644 --- a/locales/ko-KR/chat.json +++ b/locales/ko-KR/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "추론 강도" }, + "textVerbosity": { + "title": "출력 텍스트 상세 수준" + }, "thinking": { "title": "심층 사고 스위치" }, diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.json index 4da1e5c2dd..5cbee9b3be 100644 --- a/locales/nl-NL/chat.json +++ b/locales/nl-NL/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Redeneringsinspanning" }, + "textVerbosity": { + "title": "Gedetailleerdheid van de uitvoer" + }, "thinking": { "title": "Diepdenkschakelaar" }, diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.json index a6db575968..cd334e3345 100644 --- a/locales/pl-PL/chat.json +++ b/locales/pl-PL/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Intensywność rozumowania" }, + "textVerbosity": { + "title": "Poziom szczegółowości tekstu wyjściowego" + }, "thinking": { "title": "Przełącznik głębokiego myślenia" }, diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.json index b25a6a16b1..db0c1582c2 100644 --- a/locales/pt-BR/chat.json +++ b/locales/pt-BR/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Intensidade de Raciocínio" }, + "textVerbosity": { + "title": "Nível de detalhamento do texto de saída" + }, "thinking": { "title": "Interruptor de Pensamento Profundo" }, diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.json index cfc2fcfea5..4004f3d465 100644 --- a/locales/ru-RU/chat.json +++ b/locales/ru-RU/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Интенсивность рассуждений" }, + "textVerbosity": { + "title": "Уровень подробности выводимого текста" + }, "thinking": { "title": "Переключатель глубокого мышления" }, diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.json index a9b96e1648..f3085ce454 100644 --- a/locales/tr-TR/chat.json +++ b/locales/tr-TR/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Akıl Yürütme Gücü" }, + "textVerbosity": { + "title": "Çıktı metninin ayrıntı düzeyi" + }, "thinking": { "title": "Derin Düşünme Anahtarı" }, diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.json index 7cfef2e460..4678358258 100644 --- a/locales/vi-VN/chat.json +++ b/locales/vi-VN/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "Cường độ suy luận" }, + "textVerbosity": { + "title": "Mức độ chi tiết của văn bản đầu ra" + }, "thinking": { "title": "Công tắc suy nghĩ sâu" }, diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json index fb009afd8d..6e8cb55b39 100644 --- a/locales/zh-CN/chat.json +++ b/locales/zh-CN/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "推理强度" }, + "textVerbosity": { + "title": "输出文本详细程度" + }, "thinking": { "title": "深度思考开关" }, diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.json index 31555f0ca7..657a53d802 100644 --- a/locales/zh-TW/chat.json +++ b/locales/zh-TW/chat.json @@ -46,6 +46,9 @@ "reasoningEffort": { "title": "推理強度" }, + "textVerbosity": { + "title": "輸出文本詳細程度" + }, "thinking": { "title": "深度思考開關" }, diff --git a/packages/model-runtime/src/azureOpenai/index.ts b/packages/model-runtime/src/azureOpenai/index.ts index ff1d0c3fcc..1cf76a3f41 100644 --- a/packages/model-runtime/src/azureOpenai/index.ts +++ b/packages/model-runtime/src/azureOpenai/index.ts @@ -56,16 +56,33 @@ export class LobeAzureOpenAI implements LobeRuntimeAI { })); try { - const response = await this.client.chat.completions.create({ + // Create parameters with proper typing for OpenAI SDK, handling reasoning_effort compatibility + const { reasoning_effort, ...otherParams } = params; + + // Convert 'minimal' to 'low' for OpenAI SDK compatibility + const compatibleReasoningEffort = reasoning_effort === 'minimal' ? 'low' : reasoning_effort; + + const baseParams = { messages: await convertOpenAIMessages( updatedMessages as OpenAI.ChatCompletionMessageParam[], ), model, - ...params, + ...otherParams, max_completion_tokens: undefined, - stream: enableStreaming, - tool_choice: params.tools ? 'auto' : undefined, - }); + tool_choice: params.tools ? ('auto' as const) : undefined, + }; + + // Add reasoning_effort only if it exists and cast to proper type + const openaiParams = compatibleReasoningEffort + ? { + ...baseParams, + reasoning_effort: compatibleReasoningEffort as 'low' | 'medium' | 'high', + } + : baseParams; + + const response = enableStreaming + ? await this.client.chat.completions.create({ ...openaiParams, stream: true }) + : await this.client.chat.completions.create({ ...openaiParams, stream: false }); if (enableStreaming) { const stream = response as Stream; const [prod, debug] = stream.tee(); diff --git a/packages/model-runtime/src/openai/index.ts b/packages/model-runtime/src/openai/index.ts index a5b99a7adc..eaae43890c 100644 --- a/packages/model-runtime/src/openai/index.ts +++ b/packages/model-runtime/src/openai/index.ts @@ -60,7 +60,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({ provider: ModelProvider.OpenAI, responses: { handlePayload: (payload) => { - const { enabledSearch, model, tools, ...rest } = payload; + const { enabledSearch, model, tools, verbosity, ...rest } = payload; const openaiTools = enabledSearch ? [ @@ -85,6 +85,9 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({ tools: openaiTools as any, // computer-use series must set truncation as auto ...(model.startsWith('computer-use') && { truncation: 'auto' }), + text: verbosity + ? { verbosity } + : undefined, }) as any; } diff --git a/packages/model-runtime/src/types/chat.ts b/packages/model-runtime/src/types/chat.ts index 605356e57b..f280a2416b 100644 --- a/packages/model-runtime/src/types/chat.ts +++ b/packages/model-runtime/src/types/chat.ts @@ -107,7 +107,7 @@ export interface ChatStreamPayload { effort?: string; summary?: string; }; - reasoning_effort?: 'low' | 'medium' | 'high'; + reasoning_effort?: 'minimal' | 'low' | 'medium' | 'high'; responseMode?: 'stream' | 'json'; /** * @title 是否开启流式请求 @@ -119,6 +119,9 @@ export interface ChatStreamPayload { * @default 1 */ temperature: number; + text?: { + verbosity?: 'low' | 'medium' | 'high'; + }; /** * use for Claude and Gemini */ @@ -135,6 +138,7 @@ export interface ChatStreamPayload { */ top_p?: number; truncation?: 'auto' | 'disabled'; + verbosity?: 'low' | 'medium' | 'high'; } export interface ChatMethodOptions { diff --git a/packages/types/src/agent/chatConfig.ts b/packages/types/src/agent/chatConfig.ts index 67fc8b5863..e18ded0cf6 100644 --- a/packages/types/src/agent/chatConfig.ts +++ b/packages/types/src/agent/chatConfig.ts @@ -26,6 +26,11 @@ export interface LobeAgentChatConfig { enableReasoningEffort?: boolean; reasoningBudgetToken?: number; reasoningEffort?: 'low' | 'medium' | 'high'; + gpt5ReasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'; + /** + * 输出文本详细程度控制 + */ + textVerbosity?: 'low' | 'medium' | 'high'; thinking?: 'disabled' | 'auto' | 'enabled'; thinkingBudget?: number; /** @@ -71,4 +76,5 @@ export const AgentChatConfigSchema = z.object({ }) .optional(), searchMode: z.enum(['off', 'on', 'auto']).optional(), + textVerbosity: z.enum(['low', 'medium', 'high']).optional(), }); diff --git a/packages/types/src/aiModel.ts b/packages/types/src/aiModel.ts index 2c3b6a5701..70d10123f3 100644 --- a/packages/types/src/aiModel.ts +++ b/packages/types/src/aiModel.ts @@ -210,6 +210,8 @@ export type ExtendParamsType = | 'enableReasoning' | 'disableContextCaching' | 'reasoningEffort' + | 'gpt5ReasoningEffort' + | 'textVerbosity' | 'thinking' | 'thinkingBudget'; diff --git a/src/config/aiModels/aihubmix.ts b/src/config/aiModels/aihubmix.ts index 7109818fcd..bfcee341a4 100644 --- a/src/config/aiModels/aihubmix.ts +++ b/src/config/aiModels/aihubmix.ts @@ -20,12 +20,12 @@ const aihubmixModels: AIChatModelCard[] = [ units: [ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' }, { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' }, - { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' }, + { name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' }, ], }, releasedAt: '2025-08-07', settings: { - extendParams: ['reasoningEffort'], + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], searchImpl: 'params', }, type: 'chat', @@ -48,12 +48,12 @@ const aihubmixModels: AIChatModelCard[] = [ units: [ { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' }, { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' }, - { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' }, + { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' }, ], }, releasedAt: '2025-08-07', settings: { - extendParams: ['reasoningEffort'], + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], searchImpl: 'params', }, type: 'chat', @@ -61,13 +61,13 @@ const aihubmixModels: AIChatModelCard[] = [ { abilities: { functionCall: true, + imageOutput: true, reasoning: true, vision: true, }, contextWindowTokens: 400_000, description: '最快、最经济高效的 GPT-5 版本。非常适合需要快速响应且成本敏感的应用场景。', displayName: 'GPT-5 nano', - enabled: true, id: 'gpt-5-nano', maxOutput: 128_000, pricing: { @@ -78,10 +78,14 @@ const aihubmixModels: AIChatModelCard[] = [ ], }, releasedAt: '2025-08-07', + settings: { + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], + }, type: 'chat', }, { abilities: { + reasoning: true, vision: true, }, contextWindowTokens: 400_000, @@ -95,7 +99,7 @@ const aihubmixModels: AIChatModelCard[] = [ units: [ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' }, { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' }, - { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' }, + { name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' }, ], }, releasedAt: '2025-08-07', @@ -112,7 +116,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: 'o4-mini 是我们最新的小型 o 系列模型。 它专为快速有效的推理而优化,在编码和视觉任务中表现出极高的效率和性能。', displayName: 'o4-mini', - enabled: true, id: 'o4-mini', maxOutput: 100_000, pricing: { @@ -193,7 +196,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: 'o3 是一款全能强大的模型,在多个领域表现出色。它为数学、科学、编程和视觉推理任务树立了新标杆。它也擅长技术写作和指令遵循。用户可利用它分析文本、代码和图像,解决多步骤的复杂问题。', displayName: 'o3', - enabled: true, id: 'o3', maxOutput: 100_000, pricing: { @@ -699,7 +701,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: '基于Qwen3的思考模式开源模型,相较上一版本(通义千问3-235B-A22B)逻辑能力、通用能力、知识增强及创作能力均有大幅提升,适用于高难度强推理场景。', displayName: 'Qwen3 235B A22B Thinking 2507', - enabled: true, id: 'qwen3-235b-a22b-thinking-2507', maxOutput: 32_768, organization: 'Qwen', @@ -721,7 +722,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: '基于Qwen3的非思考模式开源模型,相较上一版本(通义千问3-235B-A22B)主观创作能力与模型安全性均有小幅度提升。', displayName: 'Qwen3 235B A22B Instruct 2507', - enabled: true, id: 'qwen3-235b-a22b-instruct-2507', maxOutput: 32_768, organization: 'Qwen', @@ -744,7 +744,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: '基于Qwen3的思考模式开源模型,相较上一版本(通义千问3-30B-A3B)逻辑能力、通用能力、知识增强及创作能力均有大幅提升,适用于高难度强推理场景。', displayName: 'Qwen3 30B A3B Thinking 2507', - enabled: true, id: 'qwen3-30b-a3b-thinking-2507', maxOutput: 32_768, organization: 'Qwen', @@ -766,7 +765,6 @@ const aihubmixModels: AIChatModelCard[] = [ description: '相较上一版本(Qwen3-30B-A3B)中英文和多语言整体通用能力有大幅提升。主观开放类任务专项优化,显著更加符合用户偏好,能够提供更有帮助性的回复。', displayName: 'Qwen3 30B A3B Instruct 2507', - enabled: true, id: 'qwen3-30b-a3b-instruct-2507', maxOutput: 32_768, organization: 'Qwen', diff --git a/src/config/aiModels/openai.ts b/src/config/aiModels/openai.ts index 5c7e8acf42..3176229019 100644 --- a/src/config/aiModels/openai.ts +++ b/src/config/aiModels/openai.ts @@ -42,7 +42,7 @@ export const openaiChatModels: AIChatModelCard[] = [ }, releasedAt: '2025-08-07', settings: { - extendParams: ['reasoningEffort'], + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], searchImpl: 'params', }, type: 'chat', @@ -70,7 +70,7 @@ export const openaiChatModels: AIChatModelCard[] = [ }, releasedAt: '2025-08-07', settings: { - extendParams: ['reasoningEffort'], + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], searchImpl: 'params', }, type: 'chat', @@ -78,6 +78,7 @@ export const openaiChatModels: AIChatModelCard[] = [ { abilities: { functionCall: true, + imageOutput: true, reasoning: true, vision: true, }, @@ -94,10 +95,14 @@ export const openaiChatModels: AIChatModelCard[] = [ ], }, releasedAt: '2025-08-07', + settings: { + extendParams: ['gpt5ReasoningEffort', 'textVerbosity'], + }, type: 'chat', }, { abilities: { + reasoning: true, vision: true, }, contextWindowTokens: 400_000, @@ -128,7 +133,6 @@ export const openaiChatModels: AIChatModelCard[] = [ description: 'o4-mini 是我们最新的小型 o 系列模型。 它专为快速有效的推理而优化,在编码和视觉任务中表现出极高的效率和性能。', displayName: 'o4-mini', - enabled: true, id: 'o4-mini', maxOutput: 100_000, pricing: { @@ -209,7 +213,6 @@ export const openaiChatModels: AIChatModelCard[] = [ description: 'o3 是一款全能强大的模型,在多个领域表现出色。它为数学、科学、编程和视觉推理任务树立了新标杆。它也擅长技术写作和指令遵循。用户可利用它分析文本、代码和图像,解决多步骤的复杂问题。', displayName: 'o3', - enabled: true, id: 'o3', maxOutput: 100_000, pricing: { diff --git a/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx b/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx index 579838cb73..d26eef0f85 100644 --- a/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +++ b/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx @@ -11,8 +11,10 @@ import { agentChatConfigSelectors, agentSelectors } from '@/store/agent/selector import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra'; import ContextCachingSwitch from './ContextCachingSwitch'; +import GPT5ReasoningEffortSlider from './GPT5ReasoningEffortSlider'; import ReasoningEffortSlider from './ReasoningEffortSlider'; import ReasoningTokenSlider from './ReasoningTokenSlider'; +import TextVerbositySlider from './TextVerbositySlider'; import ThinkingBudgetSlider from './ThinkingBudgetSlider'; import ThinkingSlider from './ThinkingSlider'; @@ -95,6 +97,28 @@ const ControlsForm = memo(() => { paddingBottom: 0, }, }, + { + children: , + desc: 'reasoning_effort', + label: t('extendParams.reasoningEffort.title'), + layout: 'horizontal', + minWidth: undefined, + name: 'gpt5ReasoningEffort', + style: { + paddingBottom: 0, + }, + }, + { + children: , + desc: 'text_verbosity', + label: t('extendParams.textVerbosity.title'), + layout: 'horizontal', + minWidth: undefined, + name: 'textVerbosity', + style: { + paddingBottom: 0, + }, + }, { children: , label: t('extendParams.reasoningBudgetToken.title'), diff --git a/src/features/ChatInput/ActionBar/Model/GPT5ReasoningEffortSlider.tsx b/src/features/ChatInput/ActionBar/Model/GPT5ReasoningEffortSlider.tsx new file mode 100644 index 0000000000..bfcaa44ac9 --- /dev/null +++ b/src/features/ChatInput/ActionBar/Model/GPT5ReasoningEffortSlider.tsx @@ -0,0 +1,58 @@ +import { Slider } from 'antd'; +import { memo, useCallback } from 'react'; +import { Flexbox } from 'react-layout-kit'; + +import { useAgentStore } from '@/store/agent'; +import { agentChatConfigSelectors } from '@/store/agent/selectors'; + +const GPT5ReasoningEffortSlider = memo(() => { + const [config, updateAgentChatConfig] = useAgentStore((s) => [ + agentChatConfigSelectors.currentChatConfig(s), + s.updateAgentChatConfig, + ]); + + const gpt5ReasoningEffort = config.gpt5ReasoningEffort || 'medium'; // Default to 'medium' if not set + + const marks = { + 0: 'minimal', + 1: 'low', + 2: 'medium', + 3: 'high', + }; + + const effortValues = ['minimal', 'low', 'medium', 'high']; + const indexValue = effortValues.indexOf(gpt5ReasoningEffort); + const currentValue = indexValue === -1 ? 2 : indexValue; + + const updateGPT5ReasoningEffort = useCallback( + (value: number) => { + const effort = effortValues[value] as 'minimal' | 'low' | 'medium' | 'high'; + updateAgentChatConfig({ gpt5ReasoningEffort: effort }); + }, + [updateAgentChatConfig], + ); + + return ( + + + + + + ); +}); + +export default GPT5ReasoningEffortSlider; diff --git a/src/features/ChatInput/ActionBar/Model/TextVerbositySlider.tsx b/src/features/ChatInput/ActionBar/Model/TextVerbositySlider.tsx new file mode 100644 index 0000000000..9790c1de93 --- /dev/null +++ b/src/features/ChatInput/ActionBar/Model/TextVerbositySlider.tsx @@ -0,0 +1,57 @@ +import { Slider } from 'antd'; +import { memo, useCallback } from 'react'; +import { Flexbox } from 'react-layout-kit'; + +import { useAgentStore } from '@/store/agent'; +import { agentChatConfigSelectors } from '@/store/agent/selectors'; + +const TextVerbositySlider = memo(() => { + const [config, updateAgentChatConfig] = useAgentStore((s) => [ + agentChatConfigSelectors.currentChatConfig(s), + s.updateAgentChatConfig, + ]); + + const textVerbosity = config.textVerbosity || 'medium'; // Default to 'medium' if not set + + const marks = { + 0: 'low', + 1: 'medium', + 2: 'high', + }; + + const verbosityValues = ['low', 'medium', 'high']; + const indexValue = verbosityValues.indexOf(textVerbosity); + const currentValue = indexValue === -1 ? 1 : indexValue; + + const updateTextVerbosity = useCallback( + (value: number) => { + const verbosity = verbosityValues[value] as 'low' | 'medium' | 'high'; + updateAgentChatConfig({ textVerbosity: verbosity }); + }, + [updateAgentChatConfig], + ); + + return ( + + + + + + ); +}); + +export default TextVerbositySlider; diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts index 1814f51bc4..6624fb2170 100644 --- a/src/locales/default/chat.ts +++ b/src/locales/default/chat.ts @@ -47,6 +47,9 @@ export default { reasoningEffort: { title: '推理强度', }, + textVerbosity: { + title: '输出文本详细程度', + }, thinking: { title: '深度思考开关', }, diff --git a/src/services/chat.ts b/src/services/chat.ts index 2f1c36bc6c..fe161db836 100644 --- a/src/services/chat.ts +++ b/src/services/chat.ts @@ -280,6 +280,14 @@ class ChatService { extendParams.reasoning_effort = chatConfig.reasoningEffort; } + if (modelExtendParams!.includes('gpt5ReasoningEffort') && chatConfig.gpt5ReasoningEffort) { + extendParams.reasoning_effort = chatConfig.gpt5ReasoningEffort; + } + + if (modelExtendParams!.includes('textVerbosity') && chatConfig.textVerbosity) { + extendParams.verbosity = chatConfig.textVerbosity; + } + if (modelExtendParams!.includes('thinking') && chatConfig.thinking) { extendParams.thinking = { type: chatConfig.thinking }; }