feat: 频道自动发现 — platform-bridge定时刷新频道路由 + ai-core周期同步
platform-bridge: - QQ adapter: FetchGroups/FetchFriends 从NapCat API获取 - ChannelLister接口 + ChannelInfo结构体 - GET /api/v1/channels 端点 + cachedChannels缓存 - StartChannelRefresh 每10分钟自动刷新 ai-core: - channel_sync.go: 每5分钟从platform-bridge拉取频道 - 自动更新thinker的platformChannels + botUIDs - 不再依赖PLATFORM_CHANNELS环境变量手动配置 修复: - SendMessage显式设AutoEscape:false - PLATFORM_BRIDGE_URL默认端口8082→8095 - OBv11Params.AutoEscape去掉omitempty Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -94,18 +94,22 @@ func (a *Adapter) SetGroupName(groupID int64, name string) {
|
||||
a.groupNamesMu.Unlock()
|
||||
}
|
||||
|
||||
// httpBase derives the HTTP base URL from the WebSocket remote URL.
|
||||
func (a *Adapter) httpBase() string {
|
||||
httpBase := strings.Replace(a.remoteURL, "ws://", "http://", 1)
|
||||
httpBase = strings.Replace(httpBase, "wss://", "https://", 1)
|
||||
if idx := strings.LastIndex(httpBase, "/"); idx > 8 {
|
||||
httpBase = httpBase[:idx]
|
||||
}
|
||||
return httpBase
|
||||
}
|
||||
|
||||
// fetchGroupName tries to resolve a group name via NapCat HTTP API (client mode).
|
||||
func (a *Adapter) fetchGroupName(groupID int64) {
|
||||
if a.mode != "client" || a.remoteURL == "" {
|
||||
return
|
||||
}
|
||||
// Derive HTTP base from WS URL: ws://host:port → http://host:port
|
||||
httpBase := strings.Replace(a.remoteURL, "ws://", "http://", 1)
|
||||
httpBase = strings.Replace(httpBase, "wss://", "https://", 1)
|
||||
// Strip path suffix if present
|
||||
if idx := strings.LastIndex(httpBase, "/"); idx > 8 {
|
||||
httpBase = httpBase[:idx]
|
||||
}
|
||||
httpBase := a.httpBase()
|
||||
|
||||
go func() {
|
||||
url := fmt.Sprintf("%s/get_group_info?group_id=%d", httpBase, groupID)
|
||||
|
||||
Reference in New Issue
Block a user