fix: buildThinkingUserPrompt嵌套锁死锁 + 管理员群聊路由优化
- thinker.go:1662/1762 defer t.muUnlock→立即解锁,消除buildThinkingUserPrompt自死锁 (1662持锁后1762再Lock→同goroutine自死锁→23h锁泄露→3769 goroutine泄漏) - platform-bridge: 管理员在群里@别人走group_ambient而非normal,避免频繁插嘴
This commit is contained in:
@@ -1660,8 +1660,8 @@ func (t *Thinker) buildThinkingUserPrompt(
|
||||
sb.WriteString("刚有人和你聊完天。你想自然地在心里回味一下刚才的对话……\n")
|
||||
case "silence":
|
||||
t.muLock()
|
||||
defer t.muUnlock()
|
||||
silenceDuration := time.Since(t.lastUserTime())
|
||||
t.muUnlock()
|
||||
|
||||
sb.WriteString(fmt.Sprintf("已经大约 %s 没有说话了。你有点想知道大家在做什么……\n",
|
||||
formatDurationHuman(silenceDuration)))
|
||||
@@ -1760,7 +1760,7 @@ func (t *Thinker) buildThinkingUserPrompt(
|
||||
|
||||
// OBv11 platform identity and available channels for proactive messaging.
|
||||
t.muLock()
|
||||
defer t.muUnlock()
|
||||
t.muUnlock()
|
||||
qqChannels := t.platformChannels
|
||||
botUIDs := t.botUIDs
|
||||
activeSID := t.activeSessionID
|
||||
|
||||
@@ -211,8 +211,16 @@ func main() {
|
||||
response = &bridge.UnifiedResponse{Messages: []bridge.ResponseMessage{{DisplayType: "silent"}}, Platform: msg.Platform}
|
||||
|
||||
case isAdmin:
|
||||
// 管理员在群里@别人(非bot)时,用 group_ambient 避免昔涟频繁插嘴
|
||||
if msg.ChannelType == "group" && !isBotMentioned {
|
||||
msg.RouteType = "group_ambient"
|
||||
namespace := buildMemoryNamespace(msg.Platform, msg.ChannelType, msg.ChannelID)
|
||||
fireSilent(namespace, imageURLs, videoURLs, voiceURLs)
|
||||
response, routeErr = forwardToAICore(cfg, msg, "group_ambient", chatUserID, groupSessionID, imageURLs, videoURLs, voiceURLs, isAdmin)
|
||||
} else {
|
||||
msg.RouteType = "normal"
|
||||
response, routeErr = forwardToAICore(cfg, msg, "text", chatUserID, groupSessionID, imageURLs, videoURLs, voiceURLs, isAdmin)
|
||||
}
|
||||
|
||||
case isBotMentioned:
|
||||
msg.RouteType = "normal"
|
||||
|
||||
Reference in New Issue
Block a user