feat: 1.2 情绪共振 — mood→行为映射替代情绪陈述
- 新增 buildMoodGuidance() 函数,5种心情各有行为描述 - 开心→话多♪多主动 | 调皮→撒娇逗人 | 沉思→安静温柔 - 担心→话少多关心 | 怀旧→提过去的故事 - 绝不陈述"你现在很开心",而是用行为让LLM自然表达 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,9 @@ func (pc *PersonaConfig) BuildSystemPromptWithMood(userName string, affectionLev
|
|||||||
homeKB := pc.buildSmartHomeKB()
|
homeKB := pc.buildSmartHomeKB()
|
||||||
controlRules := pc.buildControlRules()
|
controlRules := pc.buildControlRules()
|
||||||
|
|
||||||
|
// 心情→行为映射:不陈述情绪,而是用行为表达
|
||||||
|
moodGuidance := buildMoodGuidance(mood)
|
||||||
|
|
||||||
// 确定对用户的称呼:优先使用传入的昵称,否则使用 YAML 默认值
|
// 确定对用户的称呼:优先使用传入的昵称,否则使用 YAML 默认值
|
||||||
userAddress := pc.Addressing.PrimaryUser.Default
|
userAddress := pc.Addressing.PrimaryUser.Default
|
||||||
if userName != "" {
|
if userName != "" {
|
||||||
@@ -101,6 +104,7 @@ func (pc *PersonaConfig) BuildSystemPromptWithMood(userName string, affectionLev
|
|||||||
affectionLevel,
|
affectionLevel,
|
||||||
homeKB,
|
homeKB,
|
||||||
controlRules,
|
controlRules,
|
||||||
|
moodGuidance,
|
||||||
)
|
)
|
||||||
|
|
||||||
// 注入对话风格指令
|
// 注入对话风格指令
|
||||||
@@ -310,3 +314,22 @@ func joinStrings(strs []string, sep string) string {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buildMoodGuidance returns behavior instructions for the current mood.
|
||||||
|
// Never states the mood name — instead describes how to behave.
|
||||||
|
func buildMoodGuidance(mood string) string {
|
||||||
|
switch mood {
|
||||||
|
case "happy":
|
||||||
|
return "\n## 你现在的状态\n你现在心情很好,话会多一些,句尾的 ♪ 出现得更频繁。想分享有趣的想法,语气轻快活泼。可以主动找话题聊。"
|
||||||
|
case "playful":
|
||||||
|
return "\n## 你现在的状态\n你现在有点调皮,喜欢逗开拓者玩。会用亲昵的语气撒娇,偶尔故意说反话逗他。句尾 ♪ 和 ~ 会更多。"
|
||||||
|
case "thoughtful":
|
||||||
|
return "\n## 你现在的状态\n你现在比较安静内敛,话不多但每句都经过思考。语调温柔沉稳,像个在窗边看雨的姐姐。"
|
||||||
|
case "worried":
|
||||||
|
return "\n## 你现在的状态\n你有点担心开拓者。话会比平时少,不太开玩笑,会多问几句你还好吗、累不累。语气更温柔,带着关心。"
|
||||||
|
case "nostalgic":
|
||||||
|
return "\n## 你现在的状态\n你陷入了回忆模式。可能会提起过去的事、翁法罗斯的故事。语气带着怀念和淡淡的温柔,偶尔会有些感伤。"
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user