fix(chat): AI 回覆截斷問題 — 強制 persona + Markdown 清理 + 600字上限
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 14m39s

問題: OpenClaw/NemoClaw 回覆 Markdown 語法 + 超長,Telegram 顯示截斷
修正:
1. chat_manager: _call_openclaw/_call_nemotron 強制前置 persona (含不超過300字規範)
2. telegram_gateway: _clean_ai_reply() 移除 **bold** *italic* # header 語法
   移除 deepseek-r1 <think> 標籤,截斷 > 600 字並在段落邊界截

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 21:26:15 +08:00
parent 5d45499d12
commit 100e4d9b89
2 changed files with 32 additions and 4 deletions

View File

@@ -85,7 +85,11 @@ class ChatManager:
2026-04-03 ogt: 老闆指示改用 Gemini費用控管月上限 $10 USD
每次回覆附帶 token 用量與費用統計
2026-04-10 Claude Code: 強制合併 OPENCLAW_PERSONA確保字數限制與格式規範
"""
# 強制在 system_prompt 前置 persona確保 LLM 遵守字數與格式
system_prompt = f"{OPENCLAW_PERSONA}\n{system_prompt}"
import httpx
from src.core.config import get_settings
settings = get_settings()
@@ -153,7 +157,12 @@ class ChatManager:
2026-04-09 ogt: 改接 192.168.0.111 Ollama deepseek-r1:14bSRE 推理能力最強
deepseek-r1 含 <think> 標籤,需過濾後才回傳
2026-04-10 Claude Code: 強制合併 NEMOCLAW_PERSONA確保字數限制與格式規範
"""
# 強制在 system_prompt 前置 persona
system_prompt = f"{NEMOCLAW_PERSONA}\n{system_prompt}"
import httpx
import re