perf: split chat strip helper · openclaw/openclaw@d6e9ae5
steipete
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,8 +2,8 @@ import { stripInternalRuntimeContext } from "../../../../src/agents/internal-run
|
2 | 2 | import { stripInboundMetadata } from "../../../../src/auto-reply/reply/strip-inbound-meta.js"; |
3 | 3 | import { stripEnvelope } from "../../../../src/shared/chat-envelope.js"; |
4 | 4 | import { extractAssistantVisibleText as extractSharedAssistantVisibleText } from "../../../../src/shared/chat-message-content.js"; |
5 | | -import { stripThinkingTags } from "../format.ts"; |
6 | 5 | import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts"; |
| 6 | +import { stripThinkingTags } from "../strip-thinking-tags.ts"; |
7 | 7 | |
8 | 8 | const textCache = new WeakMap<object, string | null>(); |
9 | 9 | const thinkingCache = new WeakMap<object, string | null>(); |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { formatDurationHuman } from "../../../src/infra/format-time/format-duration.ts"; |
2 | 2 | import { formatRelativeTimestamp } from "../../../src/infra/format-time/format-relative.ts"; |
3 | | -import { stripAssistantInternalScaffolding } from "../../../src/shared/text/assistant-visible-text.js"; |
4 | 3 | import { t } from "../i18n/index.ts"; |
5 | 4 | |
6 | 5 | export { formatRelativeTimestamp, formatDurationHuman }; |
| 6 | +export { stripThinkingTags } from "./strip-thinking-tags.ts"; |
7 | 7 | |
8 | 8 | export function formatUnknownText( |
9 | 9 | value: unknown, |
@@ -80,10 +80,6 @@ export function toNumber(value: string, fallback: number): number {
|
80 | 80 | return Number.isFinite(n) ? n : fallback; |
81 | 81 | } |
82 | 82 | |
83 | | -export function stripThinkingTags(value: string): string { |
84 | | -return stripAssistantInternalScaffolding(value); |
85 | | -} |
86 | | - |
87 | 83 | export function formatCost(cost: number | null | undefined, fallback = "$0.00"): string { |
88 | 84 | if (cost == null || !Number.isFinite(cost)) { |
89 | 85 | return fallback; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { stripAssistantInternalScaffolding } from "../../../src/shared/text/assistant-visible-text.js"; |
| 2 | + |
| 3 | +export function stripThinkingTags(value: string): string { |
| 4 | +return stripAssistantInternalScaffolding(value); |
| 5 | +} |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。