mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 00:01:13 +00:00
fix(scripts): preserve emoji in request log previews (#109481)
* fix(scripts): preserve emoji in request log previews * fix(scripts): keep mock preview standalone * refactor(scripts): reuse UTF-16 truncation helper Co-authored-by: Leon-SK668 <0668001470@xydigit.com> * test(scripts): cover raw Node mock loading Co-authored-by: Leon-SK668 <0668001470@xydigit.com> * docs(scripts): note raw Node type stripping contract Co-authored-by: Leon-SK668 <0668001470@xydigit.com> --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// Mock OpenAI-compatible HTTP server helpers for E2E scenarios.
|
||||
import fs from "node:fs";
|
||||
// Raw launchers meet the repo's Node 22.22.3 minimum, where native TS stripping is enabled.
|
||||
import { truncateUtf16Safe } from "../../../packages/normalization-core/src/utf16-slice.ts";
|
||||
import { readPositiveIntEnv } from "./env-limits.mjs";
|
||||
|
||||
const DEFAULT_REQUEST_MAX_BYTES = 4 * 1024 * 1024;
|
||||
@@ -76,7 +78,7 @@ export function boundedRequestLogBody(value, bodyText, limits = readMockOpenAiHt
|
||||
return {
|
||||
truncated: true,
|
||||
byteLength,
|
||||
preview: bodyText.slice(0, REQUEST_LOG_PREVIEW_CHARS),
|
||||
preview: truncateUtf16Safe(bodyText, REQUEST_LOG_PREVIEW_CHARS),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user