fix: strip think tags when model emits leading whitespace before <think> (#327)

Remove ^ anchor from think/Gemma regexes in ui.js; trimStart() before startsWith checks in messages.js streaming path. Fixes MiniMax M2.7 and any model emitting leading newlines before <think>. 10 new tests, 768 total.
This commit is contained in:
nesquena-hermes
2026-04-12 14:07:00 -07:00
committed by GitHub
parent 7552cd3e9b
commit 9c44d0cf3e
5 changed files with 132 additions and 10 deletions

View File

@@ -6,6 +6,13 @@
---
## [v0.50.5] Think-tag stripping with leading whitespace (PR #327)
- **Fix think-tag rendering for models that emit leading whitespace** (e.g. MiniMax M2.7): Some models emit one or more newlines before the `<think>` opening tag. The previous regex used a `^` anchor, so it only matched when `<think>` was the very first character. When the anchor failed, the raw `</think>` tag appeared in the rendered message body.
- `static/ui.js` (stored messages): removed `^` anchor from `<think>` and Gemma channel-token regexes; switched from `.slice()` to `.replace()` + `.trimStart()` so stripping works regardless of position
- `static/messages.js` (live stream): `trimStart()` before `startsWith`/`indexOf` checks; partial-tag-prefix guard also uses trimmed buffer
- 10 new tests in `tests/test_sprint38.py`; 768 tests total (up from 758)
## [v0.50.3] Onboarding completes gracefully for pre-configured providers (PR #323, fixes #322)
- **OAuth/CLI-configured providers no longer blocked by onboarding** (closes #322): Users with providers already set up via the CLI (`openai-codex`, `copilot`, `nous`, etc.) hit `Unsupported provider for WebUI onboarding` when clicking "Open Hermes" on the finish page. The wizard now marks onboarding complete and lets them through — the agent setup is already done, no wizard steps needed.