fix: suppress <think> leakage + split reasoning output (#614) (thanks @zknicker)

This commit is contained in:
Peter Steinberger
2026-01-10 00:02:13 +01:00
parent 2d0ca67c21
commit 51ec578cec
6 changed files with 49 additions and 46 deletions

View File

@@ -37,12 +37,7 @@ export function extractAssistantThinking(msg: AssistantMessage): string {
export function formatReasoningMarkdown(text: string): string {
const trimmed = text.trim();
if (!trimmed) return "";
const lines = trimmed.split(/\r?\n/);
const wrapped = lines
.map((line) => line.trim())
.map((line) => (line ? `_${line}_` : ""))
.filter((line) => line.length > 0);
return wrapped.length > 0 ? [`_Reasoning:_`, ...wrapped].join("\n") : "";
return `Reasoning:\n${trimmed}`;
}
export function inferToolMetaFromArgs(