fix: 【不发送】标签在sendProactive路径失效 + 群聊长消息截断防封控
- sendProactive端点新增【不发送】过滤(之前只有主回复路径有) - sendProactive和主回复路径均增加群聊500字截断+最多2条限制 - 防止第三方平台适配器因过长消息触发封控 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -484,7 +484,7 @@ func startOBv11Readers(router *bridge.PlatformRouter) {
|
||||
if interval <= 0 {
|
||||
interval = 2 * time.Second
|
||||
}
|
||||
// 群聊用更长间隔避免刷屏,且限制最多2条消息
|
||||
// 群聊用更长间隔避免刷屏,限制最多2条消息,单条不超过500字防封控
|
||||
if messageType == "group" {
|
||||
minGroupInterval := 3 * time.Second
|
||||
if interval < minGroupInterval {
|
||||
@@ -493,6 +493,13 @@ func startOBv11Readers(router *bridge.PlatformRouter) {
|
||||
if len(toSend) > 2 {
|
||||
toSend = toSend[:2]
|
||||
}
|
||||
const maxRunes = 500
|
||||
for i := range toSend {
|
||||
runes := []rune(toSend[i].Content)
|
||||
if len(runes) > maxRunes {
|
||||
toSend[i].Content = string(runes[:maxRunes]) + "\n…(内容过长已截断)"
|
||||
}
|
||||
}
|
||||
}
|
||||
for i, rm := range toSend {
|
||||
if i > 0 && interval > 0 {
|
||||
|
||||
Reference in New Issue
Block a user