feat: 同平台多账号支持 — adapter_name 贯穿全链路

- UnifiedMessage 新增 AdapterName 字段
- router 从适配器 ConfigName() 捕获 adapter 实例名
- forwardToAICore source 新增 adapter_name
- ai-core SetBotUID key 优先用 adapter_name,回退 platform
- 更新优化大纲加入 P4.1

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-22 20:53:40 +08:00
parent 41f653b672
commit 2b17bb5b03
5 changed files with 64 additions and 6 deletions
+17 -3
View File
@@ -871,7 +871,8 @@ func handleChat(
SenderName string `json:"sender_name"`
OriginalUID string `json:"original_uid"`
BotUID string `json:"bot_uid"`
GroupName string `json:"group_name,omitempty"`
GroupName string
AdapterName string `json:"group_name,omitempty"`
} `json:"source,omitempty"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -888,9 +889,18 @@ func handleChat(
if thinker != nil {
thinker.RecordUserMessage(req.SessionID)
if req.Source.Platform != "" && req.Source.BotUID != "" {
thinker.SetBotUID(req.Source.Platform, req.Source.BotUID)
adapterKey := req.Source.Platform
if req.Source.AdapterName != "" {
adapterKey = req.Source.AdapterName
}
thinker.SetBotUID(adapterKey, req.Source.BotUID)
}
if req.Source.Platform != "" && req.Source.ChannelID != "" {
adapterKey := req.Source.Platform
if req.Source.AdapterName != "" {
adapterKey = req.Source.AdapterName
}
thinker.SetBotUID(adapterKey, req.Source.BotUID)
thinker.AddOrUpdatePlatformChannel(req.Source.Platform, req.Source.ChannelType, req.Source.ChannelID, req.Source.GroupName)
}
}
@@ -924,7 +934,11 @@ func handleChat(
if thinker != nil {
thinker.RecordUserMessage(req.SessionID)
if req.Source.Platform != "" && req.Source.BotUID != "" {
thinker.SetBotUID(req.Source.Platform, req.Source.BotUID)
adapterKey := req.Source.Platform
if req.Source.AdapterName != "" {
adapterKey = req.Source.AdapterName
}
thinker.SetBotUID(adapterKey, req.Source.BotUID)
}
if req.Source.Platform != "" && req.Source.ChannelID != "" {
thinker.AddOrUpdatePlatformChannel(req.Source.Platform, req.Source.ChannelType, req.Source.ChannelID, req.Source.GroupName)