diff --git a/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx b/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx
index cd1feb3b..0d09f5e1 100644
--- a/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx
+++ b/frontend-web/src/components/workspace/settings/appearance-settings-page.tsx
@@ -122,7 +122,7 @@ export function AppearanceSettingsPage() {
回答速度指示器
在生成回答时显示一个小胶囊,实时估算当前 token/s
- 并用绿到红的渐变条直观反映快慢。默认关闭。
+ 并用绿到红的渐变条直观反映快慢。默认开启。
str:
- """Remove ... blocks emitted by reasoning models (e.g. minimax, DeepSeek-R1)."""
- return re.sub(r"[\s\S]*?", "", text, flags=re.IGNORECASE).strip()
+ """Remove ... blocks emitted by reasoning models (e.g. minimax, GLM, DeepSeek-R1).
+
+ Also handles malformed cases: an unclosed `` (response truncated mid-reasoning)
+ or a stray `` (open tag eaten by upstream parsing) — both can otherwise leak
+ raw reasoning into the title.
+ """
+ text = re.sub(r"[\s\S]*?", "", text, flags=re.IGNORECASE)
+ text = re.sub(r"[\s\S]*$", "", text, flags=re.IGNORECASE)
+ text = re.sub(r"^[\s\S]*?", "", text, flags=re.IGNORECASE)
+ return text.strip()
def _parse_title(self, content: object) -> str:
"""Normalize model output into a clean title string."""
@@ -146,6 +154,36 @@ class TitleMiddleware(AgentMiddleware[TitleMiddlewareState]):
_, user_msg = self._build_title_prompt(state)
return {"title": self._fallback_title(user_msg)}
+ def _force_disable_thinking(self, model: object) -> None:
+ """Force-disable thinking on the title model via `extra_body` overrides.
+
+ Title generation never needs reasoning. The model factory only emits
+ disable params when the model config declares `when_thinking_disabled`
+ or a matching `when_thinking_enabled` shape — many user-added reasoning
+ models (e.g. GLM-4.5/5) only set `supports_thinking: true` and would
+ otherwise keep thinking on, which is slow and leaks tags into
+ the title prompt response. Injecting both common OpenAI-compatible
+ disable shapes covers Zhipu GLM (`thinking.type`) and Qwen/vLLM
+ (`chat_template_kwargs.enable_thinking`); other providers ignore
+ unknown body fields.
+ """
+ if not hasattr(model, "extra_body"):
+ return
+ current = getattr(model, "extra_body", None) or {}
+ merged_chat_template_kwargs = {
+ **(current.get("chat_template_kwargs") or {}),
+ "enable_thinking": False,
+ }
+ merged = {
+ **current,
+ "thinking": {**(current.get("thinking") or {}), "type": "disabled"},
+ "chat_template_kwargs": merged_chat_template_kwargs,
+ }
+ try:
+ model.extra_body = merged
+ except Exception:
+ logger.debug("Could not override extra_body to disable thinking on title model", exc_info=True)
+
async def _agenerate_title_result(self, state: TitleMiddlewareState) -> dict | None:
"""Generate a title asynchronously and fall back locally on failure."""
if not self._should_generate_title(state):
@@ -162,6 +200,7 @@ class TitleMiddleware(AgentMiddleware[TitleMiddlewareState]):
model = create_chat_model(name=config.model_name, **model_kwargs)
else:
model = create_chat_model(**model_kwargs)
+ self._force_disable_thinking(model)
response = await model.ainvoke(prompt, config=self._get_runnable_config())
title = self._parse_title(response.content)
if title: