对话时候严格要求json输出
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user