From c90718c6defa4e7ecff1b601dc3f1eee9c449c1d Mon Sep 17 00:00:00 2001 From: kicer Date: Wed, 29 Jul 2026 08:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=80=9D=E8=80=83=EF=BC=8C?= =?UTF-8?q?=E6=B8=A9=E5=BA=A60.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/ai/client.js | 5 ++--- server/handlers.js | 2 +- server/routes/messages.js | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/ai/client.js b/server/ai/client.js index 143297f..85601ed 100644 --- a/server/ai/client.js +++ b/server/ai/client.js @@ -19,10 +19,9 @@ function getErrorMsg(status, data) { } } -async function callDeepSeek(messages, temperature, userId) { - if (temperature === undefined) temperature = 0.1; +async function callDeepSeek(messages, userId, temperature = 0.1) { console.log('调用 DeepSeek...'); - var body = { model: 'deepseek-v4-flash', messages: messages, temperature: temperature, stream: false }; + var body = { model: 'deepseek-v4-flash', messages: messages, temperature: temperature, stream: false, thinking: { type: 'disabled' } }; if (userId) body.user_id = sanitizeUserId(userId); var res = await fetch('https://api.deepseek.com/chat/completions', { method: 'POST', diff --git a/server/handlers.js b/server/handlers.js index 5189fff..62d0881 100644 --- a/server/handlers.js +++ b/server/handlers.js @@ -187,7 +187,7 @@ async function callDeepSeekForSummary(prompt, userId) { { role: 'system', content: '你是一个财务助手,请根据采购记录生成简洁回复。' }, { role: 'user', content: prompt } ]; - return callDeepSeek(messages, 0.3, userId); + return callDeepSeek(messages, userId); } module.exports = { diff --git a/server/routes/messages.js b/server/routes/messages.js index 008dc5e..fcd81f0 100644 --- a/server/routes/messages.js +++ b/server/routes/messages.js @@ -69,7 +69,7 @@ async function analyzeWithDeepSeek(text, historyMessages, username, isAdmin, roo ...historyMessages.slice(-30), { role: 'user', content: `${username}: ${text}` } ]; - const content = await callDeepSeek(messages, 0.1, username); + const content = await callDeepSeek(messages, username); console.log('🤖 AI 返回:', content); try { const parsed = JSON.parse(content.replace(/```json|```/g, '').trim());