ds api请求时加上user_id

This commit is contained in:
2026-07-29 08:00:51 +08:00
parent e08c0cdff0
commit 416b173183
3 changed files with 15 additions and 9 deletions

View File

@@ -170,7 +170,7 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) {
if (aiResult.action === 'query') {
const purchaseData = db.prepare('SELECT item, amount, payment_method, status FROM purchases WHERE room_id = ? ORDER BY created_at DESC').all(roomId).map(p => p.item + ' ' + p.amount + ' ' + (p.payment_method||'') + ' ' + p.status).join('\n');
const summaryPrompt = '\u6839\u636e\u4ee5\u4e0b\u91c7\u8d2d\u8bb0\u5f55\uff0c\u7528\u81ea\u7136\u8bed\u8a00\u56de\u7b54\u7528\u6237\u67e5\u8be2"' + originalText + '"' + '\u3002\u91c7\u8d2d\u8bb0\u5f55\uff1a\n' + (purchaseData || '\u6682\u65e0\u8bb0\u5f55');
callDeepSeekForSummary(summaryPrompt).then(reply => { storeAndBroadcastText(roomId, '\u5c0f\u8d22', reply); addToHistory(roomId, 'assistant', reply); });
callDeepSeekForSummary(summaryPrompt, username).then(reply => { storeAndBroadcastText(roomId, '小财', reply); addToHistory(roomId, 'assistant', reply); });
return;
}
@@ -181,13 +181,13 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) {
}
}
async function callDeepSeekForSummary(prompt) {
async function callDeepSeekForSummary(prompt, userId) {
const { callDeepSeek } = require('./ai/client');
const messages = [
{ role: 'system', content: '\u4f60\u662f\u4e00\u4e2a\u8d22\u52a1\u52a9\u624b\uff0c\u8bf7\u6839\u636e\u91c7\u8d2d\u8bb0\u5f55\u751f\u6210\u7b80\u6d01\u56de\u590d\u3002' },
{ role: 'system', content: '你是一个财务助手,请根据采购记录生成简洁回复。' },
{ role: 'user', content: prompt }
];
return callDeepSeek(messages, 0.3);
return callDeepSeek(messages, 0.3, userId);
}
module.exports = {