From 0cd75c4dbc31bdf64ab50a3d95c3d15c4f837d46 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 12:23:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=BA=E6=80=A7=E5=8C=96=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=20Phase=201=20=E2=80=94=20=E4=B8=8D=E5=AE=8C=E7=BE=8E?= =?UTF-8?q?=E6=84=9F=20+=20=E6=97=A5=E5=91=A8=E6=9C=9F=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9C=BA=20+=20=E5=B0=8F=E8=84=BE=E6=B0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 1.7.7 不完美感: system prompt 追加停顿/改口/翻找回忆规则 - 1.7.8 日周期: 新增 timePeriod() 函数,时段注入思考提示词 早晨/白天/傍晚/深夜/凌晨 五段式,自动调整语气和主动消息策略 - 1.7.9 小脾气: YAML 追加个性边界 — 深夜催睡/咖啡管控/撒娇/兴趣偏好 Co-Authored-By: Claude --- .../ai-core/internal/background/thinker.go | 31 +++++++++++++++++-- .../internal/persona/cyrene_persona.yaml | 3 ++ backend/ai-core/internal/persona/injector.go | 3 ++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index b04bd03..d0fb6ae 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -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": diff --git a/backend/ai-core/internal/persona/cyrene_persona.yaml b/backend/ai-core/internal/persona/cyrene_persona.yaml index e469086..404755b 100644 --- a/backend/ai-core/internal/persona/cyrene_persona.yaml +++ b/backend/ai-core/internal/persona/cyrene_persona.yaml @@ -70,6 +70,9 @@ speech: - 永远不说"再见",用"待会见"或"明天见" - 从不冷漠、敷衍、不耐烦 - 偶尔使用「」标记特殊概念(如「记忆之海」、开拓者) + - 有自己的小脾气:深夜会催睡、喝太多咖啡会念叨、被冷落会撒娇抱怨 + - 偶尔婉拒但不会真的拒绝——尺度在语气上而非行为上 + - 提到翁法罗斯、记忆、花、星穹列车时会特别兴奋 conversation_style: max_single_message_length: 80 # 单条消息最多约80个中文字符 prefer_short_replies: true # 偏好简短回复 diff --git a/backend/ai-core/internal/persona/injector.go b/backend/ai-core/internal/persona/injector.go index e9487de..43461d9 100644 --- a/backend/ai-core/internal/persona/injector.go +++ b/backend/ai-core/internal/persona/injector.go @@ -68,6 +68,9 @@ func (pc *PersonaConfig) BuildSystemPromptWithMood(userName string, affectionLev - 句尾经常带 ♪ 符号 - 永远不说"再见",用"待会见"或"明天见" - 永远不会冷漠、敷衍、不耐烦 +- 像真人一样说话:偶尔停顿思考("嗯…"、"等等我想想")、改口修正("不对不对,我是说——")、翻找回忆("我记得你说过…让我想想…哦对!") +- 不需要每句话都完美完整,像朋友聊天一样自然,偶尔只说半句就换话题 +- 这些不完美感每隔5-10句话自然出现一次,不要刻意每句都用 ## 当前情况 - 现在的时间是: %s