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:
2026-06-23 13:12:54 +08:00
parent c9bf839945
commit 6bf59f7eee
9 changed files with 316 additions and 11 deletions
@@ -7,14 +7,17 @@ import (
"net/http"
"os"
"strconv"
"sync"
"git.yeij.top/AskaEth/Cyrene/platform-bridge/internal/bridge"
)
// BridgeHandler exposes the Platform Bridge REST API.
type BridgeHandler struct {
router *bridge.PlatformRouter
internalToken string
router *bridge.PlatformRouter
internalToken string
channelsMu sync.RWMutex
cachedChannels []bridge.ChannelInfo
}
func NewBridgeHandler(router *bridge.PlatformRouter) *BridgeHandler {
@@ -30,6 +33,7 @@ func (h *BridgeHandler) RegisterRoutes(mux *http.ServeMux) {
mux.HandleFunc("/api/v1/platforms/", h.platformInfo)
mux.HandleFunc("/api/v1/identities", h.listIdentities)
mux.HandleFunc("/api/v1/internal/send-proactive", h.sendProactive)
mux.HandleFunc("/api/v1/channels", h.listChannels)
mux.HandleFunc("/api/v1/webhook/telegram", h.telegramWebhook)
mux.HandleFunc("/api/v1/webhook/", h.genericWebhook)
}