Files
youssefvdel 1d0a4e6be8 feat: add <think>/<thinking> tag extraction with no-leak buffering
- StreamingToolParser now extracts <think> and <thinking> blocks before
  tool call parsing, buffering content until closing tag (same pattern as
  <tool_call>) — nothing leaks to client text
- Partial think tag detection prevents fragments like '<thi' from flushing
- flush() emits remaining thinking as reasoning_content
- chat.ts non-streaming path strips residual think tags from content
- Move Python debug/fix scripts to scripts/ directory
- Add integration, largeBuffer, and leak test files
- Improve JSON parsing robustness and tool call guard validation
- Update README and .gitignore
2026-05-23 21:26:00 +03:00

21 lines
645 B
Python

#!/usr/bin/env python3
with open('src/routes/chat.ts', 'r') as f:
lines = f.readlines()
fixed = 0
for i, line in enumerate(lines):
stripped = line.lstrip()
indent = line[:len(line) - len(stripped)]
# Match lines starting with "undefined" followed by angle bracket chars
if stripped.startswith('undefined'):
# Reconstruct: indent + "if (vStr" + rest_of_line_after_undefined
rest = stripped[len('undefined'):]
lines[i] = indent + 'if (vStr' + rest
fixed += 1
print(f"Fixed line {i+1}")
print(f"Total fixed: {fixed}")
with open('src/routes/chat.ts', 'w') as f:
f.writelines(lines)