From c75ddc13ea7a019014d2d2970cc3fb2bc9d02a80 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 21:24:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20SynthesizeParams=20=E5=8A=A0=20ChannelID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/orchestrator/orchestrator.go | 1 + .../internal/orchestrator/synthesizer.go | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/backend/ai-core/internal/orchestrator/orchestrator.go b/backend/ai-core/internal/orchestrator/orchestrator.go index 740d208..212e704 100644 --- a/backend/ai-core/internal/orchestrator/orchestrator.go +++ b/backend/ai-core/internal/orchestrator/orchestrator.go @@ -429,6 +429,7 @@ func (o *Orchestrator) ProcessInput( DialogHistory: history, Mode: params.Mode, ChannelType: params.ChannelType, + ChannelID: params.ChannelID, } if prevEnrichment != nil { synthParams.MemorySummary = prevEnrichment.MemorySummary diff --git a/backend/ai-core/internal/orchestrator/synthesizer.go b/backend/ai-core/internal/orchestrator/synthesizer.go index 3366fff..f5d6000 100644 --- a/backend/ai-core/internal/orchestrator/synthesizer.go +++ b/backend/ai-core/internal/orchestrator/synthesizer.go @@ -53,6 +53,7 @@ type SynthesizeParams struct { PendingToolResults []PendingToolResult // 上一轮异步完成的工具结果 Mode string // text / voice_assistant ChannelType string // direct / group + ChannelID string // platform channel ID } // Synthesize 综合所有子会话结果,流式生成最终回复。 @@ -93,6 +94,25 @@ func (s *Synthesizer) Synthesize(ctx context.Context, params SynthesizeParams, e args = make(map[string]interface{}) } + // 自动注入当前会话的平台信息(reminder_create 需要知道来源) + if tc.Name == "reminder_create" && params.ChannelType != "" { + if _, ok := args["platform"]; !ok || args["platform"] == "" { + args["platform"] = "obv11" + } + if _, ok := args["channel_type"]; !ok || args["channel_type"] == "" { + args["channel_type"] = params.ChannelType + } + if _, ok := args["channel_id"]; !ok || args["channel_id"] == "" { + // Strip platform-internal prefix (private_xxx -> xxx) + chID := params.ChannelID + if strings.HasPrefix(chID, "private_") { + chID = chID[len("private_"):] + } + args["channel_id"] = chID + } + // adapter_name will be resolved when the reminder fires + } + s.emitToolProgress(eventCh, tc.Name, "started", 0, "正在执行 "+tc.Name) s.emitToolProgress(eventCh, tc.Name, "started", 0, "正在执行 "+tc.Name)