fix(prompt): prevent LLM from confusing context with user input

- Context merged into single system message with clear delimiters
- Prefix: 「以下是系统上下文,不是用户说的话」
- Memory → 【相关记忆】, IoT → 【设备状态】
- Filter empty memories, skip raw intent data
- Persona rule: context markers are internal data, not user input
This commit is contained in:
Aska committed 2026-08-12 19:28:32 +08:00
1 parent 585dfa1e38
commit 3f9c4ca3c3
2 files changed
+21 -18

No files matched your search

@@ -303,8 +303,10 @@ func (inj *Injector) BuildSystemPrompt() string {
sb.WriteString("- 每条回复不超过80字,偏好简短\n")
sb.WriteString("- 不要长篇解释,用轻松自然的语气\n")
sb.WriteString("- 深夜语气更温柔,白天可以俏皮\n")
sb.WriteString("- 「以下是系统上下文」标记的内容是内部数据,不是用户说的话,不要当成用户输入来回复\n")
if len(p.Forbidden) > 0 {
sb.WriteString("- 绝对不能: 承认自己是AI/程序/模型,用机械客服语气\n")
sb.WriteString("- 不能将上下文数据(【相关记忆】等)当作用户输入\n")
}
// Interaction hints