diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index 226a02d..1c910e3 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -73,7 +73,7 @@ func defaultPlatformFormats() map[string]*PlatformFormat { formats := make(map[string]*PlatformFormat) obv11 := &PlatformFormat{ Label: "OBv11", - TargetRegex: `【OBv11(私聊|群聊):(\d+)(?:@(\d+))?】`, + TargetRegex: `【OBv11(私聊|群聊):(?:private_)?(\d+)(?:@(\d+))?】`, GroupMarkerFmt: "【OBv11群聊:%s】", PrivateMarkerFmt: "【OBv11私聊:%s】", GroupAtMarkerFmt: "【OBv11群聊:%s@%s】", @@ -1619,8 +1619,11 @@ func (t *Thinker) buildThinkingUserPrompt( for _, ch := range qqChannels { if ch.Platform == "obv11" && ch.ChannelID == activeChID { chLabel := activeChID + displayChID := strings.TrimPrefix(activeChID, "private_") if ch.ChannelName != "" { - chLabel = fmt.Sprintf("%s(%s)", ch.ChannelName, activeChID) + chLabel = fmt.Sprintf("%s(%s)", ch.ChannelName, displayChID) + } else if displayChID != activeChID { + chLabel = displayChID } // Last message time hint. timeHint := "" @@ -1885,8 +1888,25 @@ func (t *Thinker) extractProactiveMessage(content string) (string, *ProactiveTar if m[1] == pf.GroupKeyword { chatType = "group" } + // Resolve adapter name from registered channels. + channelID := m[2] + if chatType == "private" { + channelID = "private_" + m[2] + } + adapterName := platform // fallback to format key + t.mu.Lock() + for _, ch := range t.platformChannels { + if ch.Platform == platform && ch.ChannelType == chatType && ch.ChannelID == channelID { + if ch.AdapterName != "" { + adapterName = ch.AdapterName + } + break + } + } + t.mu.Unlock() + target = &ProactiveTarget{ - Platform: platform, + Platform: adapterName, ChatType: chatType, UserID: m[2], GroupID: m[2],