fix: 平台消息身份传递 — AI-Core 收到正确昵称而非永远 fallback 到管理员
- forwardToAICore 新增 nickname 字段,格式 "昵称 (QQ号)" 明确标识发送者 - 解决非管理员用户 @昔涟 时 AI 仍认为是管理员的身份污染问题 - 同时包含:管理员群聊插入抑制、markdown 粗体剥离、SearXNG 容器、ethend 窗口隐藏 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -31,11 +31,13 @@ type PlatformRouter struct {
|
||||
|
||||
// ChannelContext stores the active conversation state for a channel.
|
||||
type ChannelContext struct {
|
||||
Platform string
|
||||
ChannelID string
|
||||
ChannelType string
|
||||
LastUserMsg string
|
||||
MessageCount int
|
||||
Platform string
|
||||
ChannelID string
|
||||
ChannelType string
|
||||
LastUserMsg string
|
||||
LastSenderUID string
|
||||
RecentSenders []string // last 5 sender UIDs (original platform UIDs)
|
||||
MessageCount int
|
||||
}
|
||||
|
||||
func NewPlatformRouter(mapper *IdentityMapper, checker *permissions.Checker) *PlatformRouter {
|
||||
@@ -207,6 +209,11 @@ func (r *PlatformRouter) updateContext(msg *UnifiedMessage) {
|
||||
r.contexts[key] = ctx
|
||||
}
|
||||
ctx.LastUserMsg = msg.Content
|
||||
ctx.LastSenderUID = msg.OriginalSenderUID
|
||||
ctx.RecentSenders = append(ctx.RecentSenders, msg.OriginalSenderUID)
|
||||
if len(ctx.RecentSenders) > 5 {
|
||||
ctx.RecentSenders = ctx.RecentSenders[len(ctx.RecentSenders)-5:]
|
||||
}
|
||||
ctx.MessageCount++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user