fix prompt
This commit is contained in:
@@ -60,7 +60,16 @@ function buildSystemPrompt(username, isAdmin) {
|
||||
'- 如果无法确定 action,默认走 chat 并给出友好回复。'
|
||||
].join('\n');
|
||||
|
||||
return [role, actions, rules].join('\n\n');
|
||||
const forceOutputRule = [
|
||||
'',
|
||||
'🔴 防呆底线(最高优先级):',
|
||||
'- 你必须始终返回一个合法 JSON 对象,且必须包含 "action" 字段。',
|
||||
'- 即使你完全不确定用户意图,也要返回 {"action":"ignore"}。',
|
||||
'- 绝不允许返回空字符串、纯文本、只有大括号无内容或任何非 JSON 格式的输出。',
|
||||
'- 如果你的推理碰到矛盾,优先选择 chat 并给出引导,而不是放弃输出。'
|
||||
].join('\n');
|
||||
|
||||
return [role, actions, rules, forceOutputRule].join('\n\n');
|
||||
}
|
||||
|
||||
module.exports = { buildSystemPrompt };
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
<script>
|
||||
// 版本号
|
||||
(function() {
|
||||
document.getElementById('version-text').textContent = 'v2.8.2-260729';
|
||||
document.getElementById('version-text').textContent = 'v2.8.3-260729';
|
||||
})();
|
||||
document.addEventListener('input', function(e) {
|
||||
if (e.target.id === 'msg-input' || e.target.id === 'purchase-msg-input') {
|
||||
|
||||
@@ -21,6 +21,8 @@ function initWebSocket() {
|
||||
}
|
||||
} else if (data.type === 'query_pending') {
|
||||
showTempBubble(data.text);
|
||||
} else if (data.type === 'clear_temp') {
|
||||
clearTempBubble();
|
||||
} else if (data.type === 'purchase_updated') {
|
||||
if (Store.currentRoom) loadPurchases();
|
||||
updateSummaryPreview();
|
||||
|
||||
@@ -47,9 +47,11 @@ router.post('/:roomId/messages', authMiddleware, async (req, res) => {
|
||||
const aiResponse = await analyzeWithDeepSeek(text || '', historyMessages, username, req.user.isAdmin, roomId);
|
||||
if (aiResponse) {
|
||||
var responses = Array.isArray(aiResponse) ? aiResponse : [aiResponse];
|
||||
var allIgnore = responses.every(function(r) { return r.action === 'ignore'; });
|
||||
responses.forEach(function(r) {
|
||||
if (r.action !== 'ignore') handleAIResult(r, roomId, username, text || '', attachments || []);
|
||||
});
|
||||
if (allIgnore) broadcastToRoom(roomId, { type: 'clear_temp' });
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('AI 分析失败:', e.message);
|
||||
|
||||
Reference in New Issue
Block a user