feat: 实现AI拒答机制和语言控制优化

- 添加 RunStatus.REFUSED 状态,AI可明确表达拒答意图
- 优化 System Prompt 使用视觉强调提高AI对拒答规则的遵守
- User Prompt 添加 SCOPE CHECK 和语言约束
- Worker Rules 添加多语言版本角色扮演规则
- Runner 传递 language 参数到 worker stage
- json_finalize 添加语言约束参数
- 更新单元测试匹配新的 prompt 结构
This commit is contained in:
ZL-Q
2026-04-29 01:38:59 +08:00
parent adb2b3bcc3
commit f497afbff2
15 changed files with 1293 additions and 117 deletions
@@ -0,0 +1,8 @@
{"file": ".trellis/workflow.md", "reason": "Project workflow and conventions"}
{"file": ".trellis/spec/backend/index.md", "reason": "Backend development guide"}
{"file": "backend/src/core/agentscope/prompts/worker_rules.py", "reason": "Core fix: role playing language dispatch"}
{"file": "backend/src/core/agentscope/prompts/system_prompt.py", "reason": "Safety section i18n"}
{"file": "backend/src/core/agentscope/prompts/user_prompt.py", "reason": "User prompt i18n"}
{"file": "backend/src/core/agentscope/prompts/agent_prompt.py", "reason": "Agent prompt composition"}
{"file": "backend/src/core/agentscope/runtime/runner.py", "reason": "Language parameter passing"}
{"file": "backend/tests/unit/test_agentscope_prompts.py", "reason": "Test cases"}