diff --git a/static/js/markdown.js b/static/js/markdown.js index f2bb7f85f..0bfee5f41 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -165,7 +165,7 @@ export function hasUnclosedThinkTag(text) { } export function startsWithReasoningPrefix(text) { - return /^\s*(?:thinking(?:\s+process)?\s*:|the user |i need |i should |i will |they are |the question |i can )/i.test(text || ''); + return /^\s*(?:thinking(?:\s+process)?\s*:|the user |user wants|we need |i need |i should |i will |i'll |i am going |let me (?:think|look|see|check|read|review|analyze|parse|figure|draft|write)|they are |the question |i can )/i.test(text || ''); } export function normalizeThinkingMarkup(text) { @@ -236,6 +236,11 @@ function normalizePlainThinking(text) { } } + if (/^\s*(?:thinking(?:\s+process)?\s*:|the user |user wants|we need |let me (?:think|look|see|check|read|review|analyze|parse|figure|draft|write)|i need to |i should |i will |i'll |i am going )/i.test(trimmed)) { + const thinkBlock = withoutPrefix.trim(); + if (thinkBlock) return `${thinkBlock}`; + } + return text; }