fix(cron): ensure reminders keep delivery channel target

This commit is contained in:
野生派Coder~
2026-03-02 22:25:18 +08:00
parent edbb389e5d
commit 67dd45a4dd
3 changed files with 63 additions and 6 deletions

View File

@@ -387,9 +387,13 @@ func (al *AgentLoop) tryFallbackProviders(ctx context.Context, msg bus.InboundMe
func (al *AgentLoop) setSessionProvider(sessionKey, provider string) {
key := strings.TrimSpace(sessionKey)
if key == "" { return }
if key == "" {
return
}
provider = strings.TrimSpace(provider)
if provider == "" { return }
if provider == "" {
return
}
al.providerMu.Lock()
al.sessionProvider[key] = provider
al.providerMu.Unlock()
@@ -397,7 +401,9 @@ func (al *AgentLoop) setSessionProvider(sessionKey, provider string) {
func (al *AgentLoop) getSessionProvider(sessionKey string) string {
key := strings.TrimSpace(sessionKey)
if key == "" { return "" }
if key == "" {
return ""
}
al.providerMu.RLock()
v := al.sessionProvider[key]
al.providerMu.RUnlock()
@@ -703,6 +709,11 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
st.SetContext(msg.Channel, msg.ChatID)
}
}
if tool, ok := al.tools.Get("remind"); ok {
if rt, ok := tool.(*tools.RemindTool); ok {
rt.SetContext(msg.Channel, msg.ChatID)
}
}
history := al.sessions.GetHistory(msg.SessionKey)
summary := al.sessions.GetSummary(msg.SessionKey)