feat: PlatformChannel 支持 AdapterID/AdapterName — 多账号全链路区分

- PlatformChannel 新增 AdapterID + AdapterName 字段
- AddOrUpdatePlatformChannel 接受 adapter 信息参数
- channel_sync 传递 adapter_id/adapter_name
- 消息处理路径传递 adapter_name

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-23 18:01:27 +08:00
parent 45fac267fe
commit c96bd23f83
6 changed files with 16 additions and 152 deletions
+11 -1
View File
@@ -46,6 +46,8 @@ type PlatformChannel struct {
ChannelType string // group, private
ChannelID string // group ID or user OBv11 number
ChannelName string // group name or user display name (resolved at runtime)
AdapterID string // unique config ID of the adapter instance
AdapterName string // config name, e.g. "qq-main"
}
// PlatformFormat describes how proactive message targets are formatted for a platform.
@@ -312,7 +314,7 @@ func (t *Thinker) SetBotUID(platform, uid string) {
}
// AddOrUpdatePlatformChannel adds or updates a platform channel with resolved display name.
func (t *Thinker) AddOrUpdatePlatformChannel(platform, channelType, channelID, channelName string) {
func (t *Thinker) AddOrUpdatePlatformChannel(platform, channelType, channelID, channelName, adapterID, adapterName string) {
t.mu.Lock()
defer t.mu.Unlock()
@@ -321,6 +323,12 @@ func (t *Thinker) AddOrUpdatePlatformChannel(platform, channelType, channelID, c
if channelName != "" {
t.platformChannels[i].ChannelName = channelName
}
if adapterID != "" {
t.platformChannels[i].AdapterID = adapterID
}
if adapterName != "" {
t.platformChannels[i].AdapterName = adapterName
}
return
}
}
@@ -330,6 +338,8 @@ func (t *Thinker) AddOrUpdatePlatformChannel(platform, channelType, channelID, c
ChannelType: channelType,
ChannelID: channelID,
ChannelName: channelName,
AdapterID: adapterID,
AdapterName: adapterName,
})
}