feat: QQ主动消息管道 + 戳一戳事件 + thinker提示词优化
- 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>
This commit is contained in:
@@ -20,5 +20,11 @@ type PlatformAdapter interface {
|
||||
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)
|
||||
|
||||
@@ -186,6 +186,20 @@ func (r *PlatformRouter) SendResponse(response *UnifiedResponse) ([]PlatformMess
|
||||
return a.FromUnified(response)
|
||||
}
|
||||
|
||||
// SendProactive sends a proactive message through a platform adapter that supports it.
|
||||
// Returns an error if the adapter doesn't support proactive sending or the send fails.
|
||||
func (r *PlatformRouter) SendProactive(adapterName, chatType string, userID, groupID int64, content string) error {
|
||||
a, err := r.GetAdapter(adapterName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sender, ok := a.(ProactiveSender)
|
||||
if !ok {
|
||||
return fmt.Errorf("adapter %s does not support proactive sending", adapterName)
|
||||
}
|
||||
return sender.SendProactive(chatType, userID, groupID, content)
|
||||
}
|
||||
|
||||
func (r *PlatformRouter) platformHints(platform string) PlatformHints {
|
||||
cap := PlatformCapabilities{}
|
||||
if a, err := r.GetAdapter(platform); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user