cadd5f2233
- ProactiveTarget 结构体 + QQ目标正则解析(extractProactiveMessage 返回双值) - storeThought 双路推送:platform消息 → platformMessagePusher,web消息 → messagePusher - platform-bridge: SendProactive接口 + ProactiveSender + /api/v1/internal/send-proactive端点 - QQ戳一戳/notice事件 → noticeToUnified → ContentType "action" - thinker提示词注入QQ频道上下文:群名称(群号)、活跃时间、trigger-aware引导 - SetBotUID/SetPlatformMessagePusher/AddOrUpdatePlatformChannel 方法 - ai-core source 增加 BotUID/GroupName,platform-bridge source 增加 bot_uid/group_name - 支持 [CQ:at,qq=xxx] @提及标签自动拼接 Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
920 B
Go
31 lines
920 B
Go
package bridge
|
|
|
|
import "context"
|
|
|
|
// PlatformAdapter is the interface every platform adapter must implement.
|
|
type PlatformAdapter interface {
|
|
PlatformName() string
|
|
|
|
// Message conversion.
|
|
ToUnified(rawMessage interface{}) (*UnifiedMessage, error)
|
|
FromUnified(response *UnifiedResponse) ([]PlatformMessage, error)
|
|
|
|
// Capabilities.
|
|
Capabilities() PlatformCapabilities
|
|
|
|
// Connection management.
|
|
Connect(ctx context.Context) error
|
|
Disconnect(ctx context.Context) error
|
|
IsConnected() bool
|
|
HealthCheck() error
|
|
}
|
|
|
|
// ProactiveSender is an optional interface for adapters that can
|
|
// proactively send messages (e.g., QQ bot sending without prior request).
|
|
type ProactiveSender interface {
|
|
SendProactive(chatType string, userID, groupID int64, content string) error
|
|
}
|
|
|
|
// MessageHandler receives unified messages from adapters for processing.
|
|
type MessageHandler func(msg *UnifiedMessage) (*UnifiedResponse, error)
|