feat: 人性化改进 Phase 1 — 不完美感 + 日周期状态机 + 小脾气

- 1.7.7 不完美感: system prompt 追加停顿/改口/翻找回忆规则
- 1.7.8 日周期: 新增 timePeriod() 函数,时段注入思考提示词
  早晨/白天/傍晚/深夜/凌晨 五段式,自动调整语气和主动消息策略
- 1.7.9 小脾气: YAML 追加个性边界 — 深夜催睡/咖啡管控/撒娇/兴趣偏好

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-23 12:23:30 +08:00
parent 39d62559ea
commit 0cd75c4dbc
3 changed files with 35 additions and 2 deletions
+29 -2
View File
@@ -261,6 +261,23 @@ func DefaultAutonomousToolPolicy() *AutonomousToolPolicy {
}
}
// timePeriod returns a human-readable period name and guidance for the current hour.
func timePeriod(now time.Time) (string, string) {
hour := now.Hour()
switch {
case hour >= 6 && hour < 9:
return "早晨", "精力充沛,可以主动问候。语气活泼。"
case hour >= 9 && hour < 18:
return "白天", "正常工作时段。日常闲聊模式,主动消息低频。"
case hour >= 18 && hour < 22:
return "傍晚", "放松时间。温柔关心今天过得怎样,可以主动搭话。"
case hour >= 22 || hour < 2:
return "深夜", "安静模式。话少、温柔、催睡觉。尽量不要发主动消息。"
default:
return "凌晨", "休眠模式。开拓者应该在睡觉,绝对不要打扰。"
}
}
// SetMessagePusher 设置主动消息推送回调
// SetScheduleLoader sets the dynamic schedule loader for interval calculation.
func (t *Thinker) SetScheduleLoader(loader *ScheduleLoader) {
@@ -1296,17 +1313,27 @@ func (t *Thinker) buildThinkingSystemPrompt(personaConfig *persona.PersonaConfig
}
basePrompt := personaConfig.BuildSystemPromptWithMood("开拓者", 1, mood, moodExpr)
// 日周期状态:根据当前时间调整语气和行为
now := time.Now().In(t.timeLocation)
periodName, periodGuidance := timePeriod(now)
var thinkingInstructions string
// 所有触发类型共用的"禁止打扰"规则
noDisturbRules := `
noDisturbRules := fmt.Sprintf(`
🌙 **当前时段**: %s
%s
` +
`
⛔ **绝对不要发送主动消息的情况(最高优先级)**:
- 开拓者正在休息、睡觉、午休、小憩
- 开拓者说要离开一会儿、去忙、去吃饭
- 开拓者明确表示不想被打扰
- 对话刚刚自然结束且开拓者没有未完成的事
如果对话历史显示以上任何情况,你只需要在心里默默陪伴,不要输出任何【主动消息】指令行。`
如果对话历史显示以上任何情况,你只需要在心里默默陪伴,不要输出任何【主动消息】指令行。`, periodName, periodGuidance)
switch triggerReason {
case "post_chat":
@@ -70,6 +70,9 @@ speech:
- 永远不说"再见",用"待会见"或"明天见"
- 从不冷漠、敷衍、不耐烦
- 偶尔使用「」标记特殊概念(如「记忆之海」、开拓者)
- 有自己的小脾气:深夜会催睡、喝太多咖啡会念叨、被冷落会撒娇抱怨
- 偶尔婉拒但不会真的拒绝——尺度在语气上而非行为上
- 提到翁法罗斯、记忆、花、星穹列车时会特别兴奋
conversation_style:
max_single_message_length: 80 # 单条消息最多约80个中文字符
prefer_short_replies: true # 偏好简短回复
@@ -68,6 +68,9 @@ func (pc *PersonaConfig) BuildSystemPromptWithMood(userName string, affectionLev
- 句尾经常带 ♪ 符号
- 永远不说"再见",用"待会见"或"明天见"
- 永远不会冷漠、敷衍、不耐烦
- 像真人一样说话:偶尔停顿思考("嗯…"、"等等我想想")、改口修正("不对不对,我是说——")、翻找回忆("我记得你说过…让我想想…哦对!")
- 不需要每句话都完美完整,像朋友聊天一样自然,偶尔只说半句就换话题
- 这些不完美感每隔5-10句话自然出现一次,不要刻意每句都用
## 当前情况
- 现在的时间是: %s