mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:34:32 +00:00
fix(ui): strip inbound metadata blocks and guard reply-tag streaming (clean rewrite) (#22346)
* fix(ui): strip inbound metadata blocks from user messages * chore: clean up metadata-strip format and changelog credit * Update src/shared/chat-envelope.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { stripEnvelope, stripMessageIdHints } from "../shared/chat-envelope.js";
|
||||
import {
|
||||
stripEnvelope,
|
||||
stripInboundMetadataBlocks,
|
||||
stripMessageIdHints,
|
||||
} from "../shared/chat-envelope.js";
|
||||
|
||||
export { stripEnvelope };
|
||||
|
||||
@@ -12,7 +16,7 @@ function stripEnvelopeFromContent(content: unknown[]): { content: unknown[]; cha
|
||||
if (entry.type !== "text" || typeof entry.text !== "string") {
|
||||
return item;
|
||||
}
|
||||
const stripped = stripMessageIdHints(stripEnvelope(entry.text));
|
||||
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.text)));
|
||||
if (stripped === entry.text) {
|
||||
return item;
|
||||
}
|
||||
@@ -39,7 +43,7 @@ export function stripEnvelopeFromMessage(message: unknown): unknown {
|
||||
const next: Record<string, unknown> = { ...entry };
|
||||
|
||||
if (typeof entry.content === "string") {
|
||||
const stripped = stripMessageIdHints(stripEnvelope(entry.content));
|
||||
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.content)));
|
||||
if (stripped !== entry.content) {
|
||||
next.content = stripped;
|
||||
changed = true;
|
||||
@@ -51,7 +55,7 @@ export function stripEnvelopeFromMessage(message: unknown): unknown {
|
||||
changed = true;
|
||||
}
|
||||
} else if (typeof entry.text === "string") {
|
||||
const stripped = stripMessageIdHints(stripEnvelope(entry.text));
|
||||
const stripped = stripMessageIdHints(stripEnvelope(stripInboundMetadataBlocks(entry.text)));
|
||||
if (stripped !== entry.text) {
|
||||
next.text = stripped;
|
||||
changed = true;
|
||||
|
||||
Reference in New Issue
Block a user