From 4e97156e77f5de5fa81749ca633a5a900803f474 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 14:25:54 -0400 Subject: [PATCH] fix(thinking_parser): add (half-width) marker support (doeh cleanup Phase 4.1) --- src/thinking_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thinking_parser.py b/src/thinking_parser.py index 3891f7e5..901c6c0f 100644 --- a/src/thinking_parser.py +++ b/src/thinking_parser.py @@ -9,15 +9,15 @@ def parse_thinking_trace(text: str) -> Tuple[List[ThinkingSegment], str]: """ Parses thinking segments from text and returns (segments, response_content). Support extraction of thinking traces from ..., ..., - and blocks prefixed with Thinking:. - [C: tests/test_thinking_trace.py:test_parse_empty_response, tests/test_thinking_trace.py:test_parse_multiple_markers, tests/test_thinking_trace.py:test_parse_no_thinking, tests/test_thinking_trace.py:test_parse_text_thinking_prefix, tests/test_thinking_trace.py:test_parse_thinking_with_empty_response, tests/test_thinking_trace.py:test_parse_xml_thinking_tag, tests/test_thinking_trace.py:test_parse_xml_thought_tag] + ... (half-width form), and blocks prefixed with Thinking:. + [C: tests/test_thinking_trace.py:test_parse_empty_response, tests/test_thinking_trace.py:test_parse_multiple_markers, tests/test_thinking_trace.py:test_parse_no_thinking, tests/test_thinking_trace.py:test_parse_text_thinking_prefix, tests/test_thinking_trace.py:test_parse_thinking_with_empty_response, tests/test_thinking_trace.py:test_parse_xml_thinking_tag, tests/test_thinking_trace.py:test_parse_xml_thought_tag, tests/test_thinking_trace.py:test_parse_half_width_think_tag] """ segments = [] # 1. Extract and tags current_text = text # Combined pattern for tags - tag_pattern = re.compile(r'<(thinking|thought)>(.*?)', re.DOTALL | re.IGNORECASE) + tag_pattern = re.compile(r'<(thinking|thought|think)>(.*?)', re.DOTALL | re.IGNORECASE) def extract_tags(txt: str) -> Tuple[List[ThinkingSegment], str]: found_segments = []