b733e551a0
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>
15 lines
393 B
Python
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() + "…"
|