mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 12:36:55 +02:00
perf: split chat strip helper
This commit is contained in:
@@ -2,8 +2,8 @@ import { stripInternalRuntimeContext } from "../../../../src/agents/internal-run
|
||||
import { stripInboundMetadata } from "../../../../src/auto-reply/reply/strip-inbound-meta.js";
|
||||
import { stripEnvelope } from "../../../../src/shared/chat-envelope.js";
|
||||
import { extractAssistantVisibleText as extractSharedAssistantVisibleText } from "../../../../src/shared/chat-message-content.js";
|
||||
import { stripThinkingTags } from "../format.ts";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts";
|
||||
import { stripThinkingTags } from "../strip-thinking-tags.ts";
|
||||
|
||||
const textCache = new WeakMap<object, string | null>();
|
||||
const thinkingCache = new WeakMap<object, string | null>();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { formatDurationHuman } from "../../../src/infra/format-time/format-duration.ts";
|
||||
import { formatRelativeTimestamp } from "../../../src/infra/format-time/format-relative.ts";
|
||||
import { stripAssistantInternalScaffolding } from "../../../src/shared/text/assistant-visible-text.js";
|
||||
import { t } from "../i18n/index.ts";
|
||||
|
||||
export { formatRelativeTimestamp, formatDurationHuman };
|
||||
export { stripThinkingTags } from "./strip-thinking-tags.ts";
|
||||
|
||||
export function formatUnknownText(
|
||||
value: unknown,
|
||||
@@ -80,10 +80,6 @@ export function toNumber(value: string, fallback: number): number {
|
||||
return Number.isFinite(n) ? n : fallback;
|
||||
}
|
||||
|
||||
export function stripThinkingTags(value: string): string {
|
||||
return stripAssistantInternalScaffolding(value);
|
||||
}
|
||||
|
||||
export function formatCost(cost: number | null | undefined, fallback = "$0.00"): string {
|
||||
if (cost == null || !Number.isFinite(cost)) {
|
||||
return fallback;
|
||||
|
||||
5
ui/src/ui/strip-thinking-tags.ts
Normal file
5
ui/src/ui/strip-thinking-tags.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { stripAssistantInternalScaffolding } from "../../../src/shared/text/assistant-visible-text.js";
|
||||
|
||||
export function stripThinkingTags(value: string): string {
|
||||
return stripAssistantInternalScaffolding(value);
|
||||
}
|
||||
Reference in New Issue
Block a user