diff --git a/public/index.html b/public/index.html index 875a1ef3b..f5a86dfd6 100644 --- a/public/index.html +++ b/public/index.html @@ -2130,12 +2130,12 @@ Allows the model to return its thinking process. - + This setting affects visibility only. -
+
diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 104c25e8d..a1b0da67d 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -446,7 +446,7 @@ const default_settings = { electronhub_sort_models: 'alphabetically', electronhub_group_models: false, nanogpt_model: 'gpt-4o-mini', - deepseek_model: 'deepseek-chat', + deepseek_model: 'deepseek-v4-flash', aimlapi_model: 'chatgpt-4o-latest', xai_model: 'grok-3-beta', pollinations_model: 'openai', @@ -2501,6 +2501,7 @@ function getReasoningEffort(settings = null, model = null) { chat_completion_sources.COMETAPI, chat_completion_sources.ELECTRONHUB, chat_completion_sources.CHUTES, + chat_completion_sources.DEEPSEEK, ]; if (!reasoningEffortSources.includes(settings.chat_completion_source)) { @@ -2508,6 +2509,17 @@ function getReasoningEffort(settings = null, model = null) { } function resolveReasoningEffort() { + if (settings.chat_completion_source === chat_completion_sources.DEEPSEEK) { + switch (settings.reasoning_effort) { + case reasoning_effort_types.auto: + return undefined; + case reasoning_effort_types.max: + return reasoning_effort_types.max; + default: + return reasoning_effort_types.high; + } + } + switch (settings.reasoning_effort) { case reasoning_effort_types.auto: return undefined; @@ -4110,6 +4122,7 @@ function migrateChatCompletionSettings(settings) { { oldKey: 'claude_use_sysprompt', oldValue: true, newKey: 'use_sysprompt', newValue: true }, { oldKey: 'use_makersuite_sysprompt', oldValue: true, newKey: 'use_sysprompt', newValue: true }, { oldKey: 'mistralai_model', oldValue: /^(mistral-medium|mistral-small)$/, newKey: 'mistralai_model', newValue: (settings.mistralai_model + '-latest') }, + { oldKey: 'deepseek_model', oldValue: /^deepseek-(chat|reasoner|coder)$/, newKey: 'deepseek_model', newValue: 'deepseek-v4-flash' }, ]; for (const migration of migrateMap) { @@ -5622,16 +5635,8 @@ async function onModelChange() { } if (oai_settings.chat_completion_source === chat_completion_sources.DEEPSEEK) { - if (oai_settings.max_context_unlocked) { - $('#openai_max_context').attr('max', unlocked_max); - } else if (['deepseek-reasoner', 'deepseek-chat'].includes(oai_settings.deepseek_model)) { - $('#openai_max_context').attr('max', max_128k); - } else if (oai_settings.deepseek_model == 'deepseek-coder') { - $('#openai_max_context').attr('max', max_16k); - } else { - $('#openai_max_context').attr('max', max_64k); - } - + const maxContext = oai_settings.max_context_unlocked ? unlocked_max : max_1mil; + $('#openai_max_context').attr('max', maxContext); oai_settings.openai_max_context = Math.min(Number($('#openai_max_context').attr('max')), oai_settings.openai_max_context); $('#openai_max_context').val(oai_settings.openai_max_context).trigger('input'); $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); diff --git a/src/endpoints/backends/chat-completions.js b/src/endpoints/backends/chat-completions.js index df911e65f..16972d578 100644 --- a/src/endpoints/backends/chat-completions.js +++ b/src/endpoints/backends/chat-completions.js @@ -1074,9 +1074,10 @@ async function sendDeepSeekRequest(request, response) { } const processedMessages = addAssistantPrefix(postProcessPrompt(request.body.messages, PROMPT_PROCESSING_TYPE.SEMI_TOOLS, getPromptNames(request)), bodyParams.tools, 'prefix'); + addReasoningContentToToolCalls(processedMessages); - if (/-reasoner/.test(request.body.model)) { - addReasoningContentToToolCalls(processedMessages); + if (request.body.include_reasoning && request.body.reasoning_effort) { + bodyParams['reasoning_effort'] = request.body.reasoning_effort; } const requestBody = { @@ -1090,6 +1091,7 @@ async function sendDeepSeekRequest(request, response) { 'top_p': request.body.top_p, 'stop': request.body.stop, 'seed': request.body.seed, + 'thinking': { type: request.body.include_reasoning ? 'enabled' : 'disabled' }, ...bodyParams, };