对话时候严格要求json输出

This commit is contained in:
2026-07-29 08:12:37 +08:00
parent c90718c6de
commit 0e17abd653
2 changed files with 3 additions and 2 deletions

View File

@@ -19,9 +19,10 @@ function getErrorMsg(status, data) {
}
}
async function callDeepSeek(messages, userId, temperature = 0.1) {
async function callDeepSeek(messages, userId, temperature = 0.1, jsonMode = true) {
console.log('调用 DeepSeek...');
var body = { model: 'deepseek-v4-flash', messages: messages, temperature: temperature, stream: false, thinking: { type: 'disabled' } };
if (jsonMode) body.response_format = { type: 'json_object' };
if (userId) body.user_id = sanitizeUserId(userId);
var res = await fetch('https://api.deepseek.com/chat/completions', {
method: 'POST',