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());