Files
crypto_monitor/manual_trading_hub/hub_ai/text_util.py
T
dekun b733e551a0 Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 23:42:26 +08:00

15 lines
393 B
Python

"""中控 AI 文本小工具."""
def is_ai_error_reply(text: str) -> bool:
t = (text or "").strip()
return t.startswith("AI 调用失败") or t.startswith("AI 生成失败")
def clip_text(text: str, max_chars: int) -> str:
s = str(text or "").strip()
limit = max(200, int(max_chars or 0))
if len(s) <= limit:
return s
return s[: limit - 1].rstrip() + ""