From 06fd2f4aaff78a5292b80666466b7422344e2ee3 Mon Sep 17 00:00:00 2001 From: Aska Date: Mon, 7 Sep 2026 20:18:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(backthink):=20=E4=B8=BB=E5=8A=A8=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E4=B9=9F=E8=90=BD=E4=B8=BB=E4=BC=9A=E8=AF=9D=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E2=80=94=E2=80=94=E4=BF=AE=E5=A4=8D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=97=B6=E4=B8=8A=E4=B8=8B=E6=96=87=E6=96=AD=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bridge.SendProactive 之前只发送不落历史,导致她主动说的话不在主会话 chat_messages, 你回复时 LLM 看不到她的主动消息→上下文不连贯。现发送后 persistToMain 镜像到主会话 (assistant+platform+deviceID),你回复时上下文带上她的主动消息。build/test 全绿。 --- internal/services/channelbridge/proactive.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/services/channelbridge/proactive.go b/internal/services/channelbridge/proactive.go index 953d8ba..511fc9b 100644 --- a/internal/services/channelbridge/proactive.go +++ b/internal/services/channelbridge/proactive.go @@ -6,6 +6,7 @@ import ( "strings" "git.yeij.top/AskaEth/Cyrene_v2/internal/channel/adapter" + "git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/history" ) // proactiveTarget is the owner's IM address (platform + account id) resolved for @@ -46,6 +47,13 @@ func (b *Bridge) SendProactive(ctx context.Context, msg adapter.UnifiedMessage) if err := ad.SendProactive(ctx, out); err != nil { return fmt.Errorf("channelbridge: send proactive via %q: %w", target.platform, err) } + // Mirror the proactive message into the main conversation context (design/16 + // §4.4 + §4.6.1). Without this the model would not see what it proactively said, so + // a follow-up owner reply would feel incoherent (the message "loses" its history). + // It is the same mirror path as owner-private IM replies, scoped to MainSessionID. + b.persistToMain(ctx, history.RoleAssistant, msg.Content, target.platform, + fmt.Sprintf("%s:%s:%s", target.platform, target.accountID, target.accountID), + target.platform) return nil }