mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-31 02:18:08 +00:00
fix(imessage): coalesce merged text on UTF-16 code-point boundary
This commit is contained in:
parent
1841c4caf5
commit
352f47f888
1 changed files with 2 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
// Imessage plugin module implements the same-sender inbound debounce merge.
|
||||
import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
||||
import type { IMessagePayload } from "./types.js";
|
||||
|
||||
// Keep the merge contract narrow (caps, ID tracking, reply-context preference)
|
||||
|
|
@ -136,7 +137,7 @@ export function combineIMessagePayloads(payloads: IMessagePayload[]): CoalescedI
|
|||
}
|
||||
let combinedText = textParts.join(" ");
|
||||
if (combinedText.length > MAX_COALESCED_TEXT_CHARS) {
|
||||
combinedText = `${combinedText.slice(0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
|
||||
combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
|
||||
}
|
||||
|
||||
// Merge attachments across bounded entries, capped to keep downstream media
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue