From aab2596d29a850a185eb0c25c83f7dcf7387d9fc Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:47:11 -0300 Subject: [PATCH] UI: Fix multiple thinking blocks rendering as raw text in HTML generator --- modules/html_generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index 138d4ade..8f3f261f 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -369,8 +369,10 @@ def convert_to_markdown(string, message_id=None): if not text.strip(): return - thinking_content, remaining = extract_thinking_block(text) - if thinking_content is not None: + while text.strip(): + thinking_content, remaining = extract_thinking_block(text) + if thinking_content is None: + break has_remaining = bool(remaining.strip()) or not is_last_segment html_parts.append(build_thinking_block(thinking_content, message_id, has_remaining, think_idx)) think_idx += 1