Octopus
c91785dd68
fix(title): strip <think> tags from title model responses and assistant context ( #1927 )
...
* fix(title): strip <think> tags from title model responses and assistant context
Reasoning models (e.g. minimax M2.7, DeepSeek-R1) emit <think>...</think>
blocks before their actual output. When such a model is used as the title
model (or as the main agent), the raw thinking content leaked into the thread
title stored in state, so the chat list showed the internal monologue instead
of a meaningful title.
Fixes #1884
- Add `_strip_think_tags()` helper using a regex to remove all <think>...</think> blocks
- Apply it in `_parse_title()` so the title model response is always clean
- Apply it to the assistant message in `_build_title_prompt()` so thinking
content from the first AI turn is not fed back to the title model
- Add four new unit tests covering: stripping in parse, think-only response,
assistant prompt stripping, and end-to-end async flow with think tags
* Fix the lint error
---------
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-04-14 09:51:39 +08:00
..
2026-04-10 20:40:30 +08:00
2026-03-27 20:03:30 +08:00
2026-04-01 11:42:12 +08:00
2026-03-31 22:19:27 +08:00
2026-04-02 15:39:41 +08:00
2026-04-14 00:03:38 +08:00
2026-03-26 17:44:25 +08:00
2026-04-06 22:14:12 +08:00
2026-04-06 22:14:12 +08:00
2026-03-14 22:55:52 +08:00
2026-04-07 10:47:20 +08:00
2026-04-08 21:04:20 +08:00
2026-03-30 07:41:18 +08:00
2026-04-07 18:21:22 +08:00
2026-03-29 21:03:58 +08:00
2026-03-29 21:03:58 +08:00
2026-04-10 18:16:38 +08:00
2026-04-09 16:07:16 +08:00
2026-03-14 22:55:52 +08:00
2026-03-29 15:31:18 +08:00
2026-04-06 16:47:19 +08:00
2026-03-22 22:39:50 +08:00
2026-04-14 00:03:38 +08:00
2026-04-12 19:11:22 +08:00
2026-04-11 17:48:04 +08:00
2026-03-31 22:19:27 +08:00
2026-04-10 17:43:39 +08:00
2026-04-08 17:13:39 +08:00
2026-04-06 22:14:12 +08:00
2026-04-04 14:25:08 +08:00
2026-04-10 17:43:39 +08:00
2026-04-01 23:21:32 +08:00
2026-03-23 18:07:33 +08:00
2026-03-14 22:55:52 +08:00
2026-03-26 14:20:18 +08:00
2026-04-03 15:28:56 +08:00
2026-04-13 21:15:24 +08:00
2026-03-29 15:34:38 +08:00
2026-04-09 16:12:34 +08:00
2026-04-07 10:50:34 +08:00
2026-04-12 17:48:40 +08:00
2026-04-11 16:52:10 +08:00
2026-03-29 21:31:29 +08:00
2026-04-11 17:41:36 +08:00
2026-04-12 19:11:22 +08:00
2026-03-14 22:55:52 +08:00
2026-03-14 22:55:52 +08:00
2026-03-26 14:20:18 +08:00
2026-04-03 11:21:58 +08:00
2026-04-05 16:23:00 +08:00
2026-04-01 16:45:29 +08:00
2026-03-29 15:34:38 +08:00
2026-04-05 16:23:00 +08:00
2026-04-05 16:23:00 +08:00
2026-03-22 20:39:26 +08:00
2026-04-09 18:49:00 +08:00
2026-04-09 16:07:16 +08:00
2026-03-20 17:18:59 +08:00
2026-03-26 15:07:05 +08:00
2026-04-13 22:59:13 +08:00
2026-04-10 20:40:30 +08:00
2026-04-10 20:40:30 +08:00
2026-03-14 22:55:52 +08:00
2026-03-14 22:55:52 +08:00
2026-03-31 22:22:30 +08:00
2026-04-09 17:56:36 +08:00
2026-04-07 17:15:24 +08:00
2026-04-09 17:21:23 +08:00
2026-04-09 17:21:23 +08:00
2026-04-03 16:03:06 +08:00
2026-04-10 22:55:53 +08:00
2026-04-06 22:07:11 +08:00
2026-03-30 16:02:23 +08:00
2026-03-26 14:20:18 +08:00
2026-04-10 17:43:39 +08:00
2026-04-07 10:50:34 +08:00
2026-03-25 16:28:33 +08:00
2026-04-14 09:00:29 +08:00
2026-03-26 17:39:16 +08:00
2026-04-06 22:07:11 +08:00
2026-04-01 23:08:30 +08:00
2026-03-27 20:20:31 +08:00
2026-03-30 16:02:23 +08:00
2026-04-06 14:51:10 +08:00
2026-04-08 11:46:06 +08:00
2026-03-25 10:20:16 +08:00
2026-04-09 16:12:34 +08:00
2026-04-12 16:40:21 +08:00
2026-04-04 21:19:35 +08:00
2026-04-07 11:12:25 +08:00
2026-03-26 17:39:16 +08:00
2026-03-24 00:36:08 +08:00
2026-03-14 22:55:52 +08:00
2026-04-14 09:51:39 +08:00
2026-03-26 00:20:50 +08:00
2026-03-26 14:20:18 +08:00
2026-03-14 22:55:52 +08:00
2026-04-06 15:09:57 +08:00
2026-03-30 11:23:15 +08:00
2026-04-02 13:06:10 +08:00
2026-04-02 13:06:10 +08:00
2026-03-26 17:39:16 +08:00
2026-04-11 16:52:10 +08:00
2026-03-27 17:37:44 +08:00
2026-04-06 15:18:34 +08:00
2026-04-10 20:49:28 +08:00