fix prompt

This commit is contained in:
2026-07-29 11:36:44 +08:00
parent cd41676ee3
commit e08a17ffa0
4 changed files with 15 additions and 2 deletions

View File

@@ -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 };