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:
@@ -280,10 +280,7 @@ func (a *Adapter) ToUnified(rawMessage interface{}) (*bridge.UnifiedMessage, err
|
||||
func (a *Adapter) FromUnified(response *bridge.UnifiedResponse) ([]bridge.PlatformMessage, error) {
|
||||
var msgs []bridge.PlatformMessage
|
||||
for _, rm := range response.Messages {
|
||||
content := rm.Content
|
||||
if rm.FormatMode == "markdown" {
|
||||
content = convertMarkdownToQQ(rm.Content)
|
||||
}
|
||||
content := convertMarkdownToQQ(rm.Content)
|
||||
runes := []rune(content)
|
||||
if len(runes) > 200 {
|
||||
content = string(runes[:200])
|
||||
@@ -421,6 +418,9 @@ func extractText(msg *OBv11Message) string {
|
||||
|
||||
var cqImageRegex = regexp.MustCompile(`\[CQ:image,[^\]]*\]`)
|
||||
var cqURLRegex = regexp.MustCompile(`\burl=([^,\]]+)`)
|
||||
var boldRegex = regexp.MustCompile(`\*\*(.+?)\*\*`)
|
||||
var italicRegex = regexp.MustCompile(`\*(.+?)\*`)
|
||||
var strikethroughRegex = regexp.MustCompile(`~~(.+?)~~`)
|
||||
|
||||
// extractAttachments extracts image URLs from OBv11Message.
|
||||
// Handles both string format (CQ codes in raw_message) and array format (parsed segments).
|
||||
@@ -473,8 +473,11 @@ func extractAttachments(msg *OBv11Message) []bridge.Attachment {
|
||||
return attachments
|
||||
}
|
||||
|
||||
// convertMarkdownToQQ converts common markdown to QQ-supported format.
|
||||
// convertMarkdownToQQ converts markdown to QQ plain-text format.
|
||||
func convertMarkdownToQQ(md string) string {
|
||||
md = boldRegex.ReplaceAllString(md, "$1")
|
||||
md = italicRegex.ReplaceAllString(md, "$1")
|
||||
md = strikethroughRegex.ReplaceAllString(md, "$1")
|
||||
md = removeHeadings(md)
|
||||
md = removeCodeBlocks(md)
|
||||
return md
|
||||
|
||||
Reference in New Issue
Block a user