diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-02-25 16:57:55 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-02-25 16:57:55 +0300 |
| commit | 9f51bd385336e7b314316c372bc31de2a3c374f4 (patch) | |
| tree | baefc4ba8e5bec89d5df89c05be8d9df9d820025 /bot.go | |
| parent | b386c1181f0424418999fe143f1285d395b0db0f (diff) | |
Fix: text manipulation for multimodal messages
Diffstat (limited to 'bot.go')
| -rw-r--r-- | bot.go | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -119,7 +119,7 @@ func processMessageTag(msg *models.RoleMsg) *models.RoleMsg { } // If KnownTo already set, assume tag already processed (content cleaned). // However, we still check for new tags (maybe added later). - knownTo := parseKnownToTag(msg.Content) + knownTo := parseKnownToTag(msg.GetText()) // If tag found, replace KnownTo with new list (merge with existing?) // For simplicity, if knownTo is not nil, replace. if knownTo == nil { @@ -1303,12 +1303,9 @@ func removeThinking(chatBody *models.ChatBody) { if msg.Role == cfg.ToolRole { continue } - // find thinking and remove it - rm := models.RoleMsg{ - Role: msg.Role, - Content: thinkRE.ReplaceAllString(msg.Content, ""), - } - msgs = append(msgs, rm) + // find thinking and remove it - use SetText to preserve ContentParts + msg.SetText(thinkRE.ReplaceAllString(msg.GetText(), "")) + msgs = append(msgs, msg) } chatBody.Messages = msgs } |
