mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 18:42:25 +00:00
refactor(text): remove unused final tag predicate
This commit is contained in:
@@ -58,7 +58,7 @@ import { resolveProviderThinkingProfile } from "../plugins/provider-runtime.js";
|
||||
import type { ProviderThinkingModelCompat } from "../plugins/provider-thinking.types.js";
|
||||
import { DEFAULT_AGENT_ID } from "../routing/session-key.js";
|
||||
import { stripAssistantInternalScaffolding } from "../shared/text/assistant-visible-text.js";
|
||||
import { containsFinalTag, stripFinalTags } from "../shared/text/final-tags.js";
|
||||
import { findFinalTagMatches, stripFinalTags } from "../shared/text/final-tags.js";
|
||||
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
|
||||
import { GatewayClient } from "./client.js";
|
||||
import {
|
||||
@@ -598,7 +598,7 @@ function assertNoReasoningTags(params: {
|
||||
if (!params.text) {
|
||||
return;
|
||||
}
|
||||
if (THINKING_TAG_RE.test(params.text) || containsFinalTag(params.text)) {
|
||||
if (THINKING_TAG_RE.test(params.text) || findFinalTagMatches(params.text).length > 0) {
|
||||
const snippet = params.text.length > 200 ? `${params.text.slice(0, 200)}…` : params.text;
|
||||
throw new Error(
|
||||
`[${params.label}] reasoning tag leak (${params.model} / ${params.phase}): ${snippet}`,
|
||||
|
||||
@@ -130,11 +130,6 @@ export function findFinalTagMatches(text: string): FinalTagMatch[] {
|
||||
return matches;
|
||||
}
|
||||
|
||||
/** Returns true when text contains at least one valid `<final>` control tag. */
|
||||
export function containsFinalTag(text: string): boolean {
|
||||
return findFinalTagMatches(text).length > 0;
|
||||
}
|
||||
|
||||
/** Removes valid `<final>` tags while preserving their enclosed visible answer text. */
|
||||
export function stripFinalTags(text: string): string {
|
||||
let output = "";
|
||||
|
||||
Reference in New Issue
Block a user