fix(nemotron): deepseek-r1 num_predict 400→1200,避免 <think> block 截斷後空回覆
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 28s

deepseek-r1:14b 思考 token 超過 400 會在 </think> 前截斷,導致
清理後 body 為空,Telegram 顯示空訊息。
- chat_manager: num_predict 400 → 1200
- telegram_gateway: _clean_ai_reply 空值加 fallback 錯誤提示

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 22:35:37 +08:00
parent de6dcd181a
commit 797c7c749e
2 changed files with 4 additions and 3 deletions

View File

@@ -180,7 +180,7 @@ class ChatManager:
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_message},
],
"options": {"num_predict": 400},
"options": {"num_predict": 1200},
},
)
resp.raise_for_status()

View File

@@ -3718,7 +3718,7 @@ class TelegramGateway:
f"{context}\n用戶 {username} 在 SRE 戰情室問你:",
clean_text,
)
body = _clean_ai_reply(result) if result else '🔴 無響應 (NIM 超時)'
body = (_clean_ai_reply(result) if result else '') or '🔴 無響應 (deepseek-r1 超時或思考截斷)'
await self.send_as_nemotron(
text=f"🤖 <b>NemoClaw</b>\n\n{body}",
reply_to_message_id=message_id,
@@ -3741,8 +3741,9 @@ class TelegramGateway:
)
if nemo_result and not isinstance(nemo_result, Exception):
nemo_body = _clean_ai_reply(nemo_result) or "🔴 回覆清理後為空 (deepseek-r1 思考超時)"
await self.send_as_nemotron(
text=f"🤖 <b>NemoClaw</b>\n\n{_clean_ai_reply(nemo_result)}",
text=f"🤖 <b>NemoClaw</b>\n\n{nemo_body}",
reply_to_message_id=message_id,
)