Merge: paliadin meta-trailer defensive strip in renderer
This commit is contained in:
@@ -89,7 +89,17 @@ function renderBlocks(escapedHtml: string): string {
|
||||
return out.join("");
|
||||
}
|
||||
|
||||
// The [paliadin-meta] … [/paliadin-meta] trailer is internal telemetry
|
||||
// (used_tools / rows_seen / classifier_tag) that the backend is meant to
|
||||
// strip. Defensively strip it here too so it can NEVER reach the user even
|
||||
// when the backend's strip misses it (e.g. an empty meta block on a greeting,
|
||||
// or a chunk the aichat backend didn't catch). It always sits at the end,
|
||||
// optionally preceded by a `---` separator, so we cut from the opener to EOS —
|
||||
// which also handles a truncated/unterminated trailer.
|
||||
const META_TRAILER_RE = /\n*\s*(?:-{3,}\s*\n+)?\[paliadin-meta\][\s\S]*$/i;
|
||||
|
||||
export function renderResponseHTML(raw: string): string {
|
||||
raw = raw.replace(META_TRAILER_RE, "").replace(/\s+$/, "");
|
||||
let html = raw
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
|
||||
Reference in New Issue
Block a user