From 1c524824975c34025ae19459c2e31e356a49b3da Mon Sep 17 00:00:00 2001 From: shuiyu67 Date: Fri, 7 Aug 2026 19:35:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=9E=20TTY=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=B8=80=E5=8F=A5=E9=9A=8F=E6=9C=BA=E6=83=85?= =?UTF-8?q?=E8=AF=9D=EF=BC=88=E4=BF=AE=E5=A4=8D=E5=90=8E=E4=BF=9D=E4=BA=BA?= =?UTF-8?q?=E5=91=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一版加载动画修复在非 TTY(聊天前端/管道)只输出静态提示, 导致聊天界面完全看不到情话、没了"人味"。 - 非 TTY 分支改为:请求开始时输出一句随机情话(💭 前缀), 只打一次、不跑逐帧 \r 动画,零残帧污染 - love.txt 读取时过滤 http/https 行,避免把反战标语/网址当情话甩出 - 真 TTY 逐帧情话+spinner 动画、TUI 模式均不受影响 --- xcli_core/cli_core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xcli_core/cli_core.py b/xcli_core/cli_core.py index 7ebac15..de61c68 100644 --- a/xcli_core/cli_core.py +++ b/xcli_core/cli_core.py @@ -972,7 +972,9 @@ multi 操作支持一次修改多处: if os.path.exists(love_file_path): try: with open(love_file_path, 'r', encoding='utf-8') as f: - love_sentences = [line.strip() for line in f.readlines() if line.strip()] + love_sentences = [line.strip() for line in f.readlines() + if line.strip() + and not line.strip().lower().startswith(('http://', 'https://'))] except Exception: pass if not love_sentences: @@ -1019,10 +1021,10 @@ multi 操作支持一次修改多处: # ── 动画线程 ── def show_animation(): - # 非 TTY:只输出一行静态提示,不跑逐帧 \r 动画(避免残帧进入捕获流) + # 非 TTY:不跑逐帧 \r 动画(避免残帧进入捕获流),但保留一句随机情话保人味 if not is_tty: try: - print("⏳ AI 正在思考中…", flush=True) + print(f"💭 {random.choice(love_sentences)}", flush=True) except Exception: pass return