mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-13 10:15:48 +00:00
feat(discord): enable binding-based agent routing (#1243)
Clear targetAgentID in handleMessage so the gateway consumer's resolveAgentRoute matches via cfg.Bindings instead of always using the channel instance's agent_id. Without this patch, all Discord channels route to the channel instance's default agent, ignoring bindings in config.json. Add slog.Info call for routing diagnostics. Co-authored-by: Duy /zuey/ <duy@wearetopgroup.com> Co-authored-by: Said <msaidf@users.noreply.github.com>
This commit is contained in:
1 file changed
+12
-1
@@ -302,8 +302,19 @@ func (c *Channel) handleMessage(_ *discordgo.Session, m *discordgo.MessageCreate
|
||||
}
|
||||
}
|
||||
|
||||
// PATCHED: Clear AgentID so the gateway consumer's resolveAgentRoute
|
||||
// (cmd/gateway_consumer_normal.go:40-43) matches via cfg.Bindings.
|
||||
// The consumer checks: if msg.AgentID == "" → resolveAgentRoute(cfg, msg.Channel, msg.ChatID, msg.PeerKind)
|
||||
// Bindings in config.json match by channel name + peer.kind + peer.id.
|
||||
// If no binding matches, resolveAgentRoute falls back to cfg.ResolveDefaultAgentID().
|
||||
targetAgentID := ""
|
||||
slog.Info("discord: binding routing enabled",
|
||||
"channel_id", channelID,
|
||||
"channel_name", c.Name(),
|
||||
"peer_kind", peerKind,
|
||||
)
|
||||
|
||||
// Voice agent routing
|
||||
targetAgentID := c.AgentID()
|
||||
if c.config.VoiceAgentID != "" {
|
||||
for _, mi := range mediaList {
|
||||
if mi.Type == media.TypeAudio || mi.Type == media.TypeVoice {
|
||||
|
||||
Reference in new issue
Block a user