

























@@ -351,7 +351,14 @@ function maybeStripAssistantScaffoldingForLiveModel(text: string, modelKey?: str
351351if (!shouldStripAssistantScaffoldingForLiveModel(modelKey)) {
352352return text;
353353}
354-return stripAssistantInternalScaffolding(text).trim();
354+return stripAssistantInternalScaffolding(stripKnownLiveReasoningWrappers(text)).trim();
355+}
356+357+function stripKnownLiveReasoningWrappers(text: string): string {
358+return text
359+.replace(/<\s*think\b[^<>]*>[\s\S]*?<\s*\/\s*think\s*>/gi, "")
360+.replace(/^[\s\S]*?<\s*\/\s*think\s*>\s*/i, "")
361+.replace(/<\s*final\b[^<>]*>([\s\S]*?)<\s*\/\s*final\s*>/gi, "$1");
355362}
356363357364function shouldSkipExecReadNonceMissForLiveModel(modelKey?: string): boolean {
@@ -425,6 +432,20 @@ describe("maybeStripAssistantScaffoldingForLiveModel", () => {
425432"google/gemini-3.1-pro-preview-customtools",
426433),
427434).toBe("Visible");
435+expect(
436+maybeStripAssistantScaffoldingForLiveModel(
437+[
438+"<think>",
439+"1. Inspect",
440+"```",
441+"draft",
442+"```",
443+"2. Draft the explanation",
444+"</think>The event loop drains the microtask queue before the next macrotask.",
445+].join("\n"),
446+"google/gemini-3-flash-preview",
447+),
448+).toBe("The event loop drains the microtask queue before the next macrotask.");
428449});
429450430451it("strips scaffolding for known OpenAI transcript wrappers", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。