feat: show reasoning/thinking blocks when show_reasoning is enabled

- Add <thinking> tag to streaming filter's tag list
- When show_reasoning is on, route XML reasoning content to the
  reasoning display box instead of silently discarding it
- Expand _strip_think_blocks to handle all tag variants:
  <think>, <thinking>, <THINKING>, <reasoning>, <REASONING_SCRATCHPAD>
This commit is contained in:
Test 2026-03-19 19:44:31 -07:00
parent 04b6ecadc4
commit b1832faaae
2 changed files with 26 additions and 7 deletions

View file

@ -1078,10 +1078,16 @@ class AIAgent:
return bool(cleaned.strip())
def _strip_think_blocks(self, content: str) -> str:
"""Remove <think>...</think> blocks from content, returning only visible text."""
"""Remove reasoning/thinking blocks from content, returning only visible text."""
if not content:
return ""
return re.sub(r'<think>.*?</think>', '', content, flags=re.DOTALL)
# Strip all reasoning tag variants: <think>, <thinking>, <THINKING>,
# <reasoning>, <REASONING_SCRATCHPAD>
content = re.sub(r'<think>.*?</think>', '', content, flags=re.DOTALL)
content = re.sub(r'<thinking>.*?</thinking>', '', content, flags=re.DOTALL | re.IGNORECASE)
content = re.sub(r'<reasoning>.*?</reasoning>', '', content, flags=re.DOTALL)
content = re.sub(r'<REASONING_SCRATCHPAD>.*?</REASONING_SCRATCHPAD>', '', content, flags=re.DOTALL)
return content
def _looks_like_codex_intermediate_ack(
self,