From 40852de280a046805d2e0b16dd166b97df74bf05 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 22 Jul 2026 00:24:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20LLM=E7=A9=BA=E8=BE=93=E5=87=BA=E8=A7=86?= =?UTF-8?q?=E4=B8=BA=E5=A4=B1=E8=B4=A5=20+=20save=5Fresult=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E5=86=99=E5=85=A5=E7=A9=BA=E5=88=86=E6=9E=90=EF=BC=88?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=81=87=E6=97=B6=E9=97=B4=E6=88=B3=E8=B7=B3?= =?UTF-8?q?=E8=BF=87=E6=9C=BA=E5=88=B6=E5=A4=B1=E6=95=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/batch_reassess.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deploy/profile-scripts/batch_reassess.py b/deploy/profile-scripts/batch_reassess.py index 1bc1c211..53c0005a 100644 --- a/deploy/profile-scripts/batch_reassess.py +++ b/deploy/profile-scripts/batch_reassess.py @@ -326,7 +326,10 @@ def parse_response(text): return result def save_result(code, full_text, parsed): - """保存LLM结果到DB(先快照再UPDATE)""" + """保存LLM结果到DB(先快照再UPDATE)。空分析拒绝写入。""" + if not (full_text or "").strip(): + print(f" \u274c 拒绝写入空分析(LLM输出为空,保护已有数据)") + return conn = sqlite3.connect(DB) now = datetime.now().isoformat() @@ -410,8 +413,8 @@ def process_stock(code, force_today=False): # ── 使用共享 LLM 客户端(替代 curl subprocess)── result = call_llm(prompt, model=REASSESS_MODEL, max_tokens=4096) - if not result["ok"]: - print(f" \u274c LLM调用失败: {result.get('error','未知错误')}") + if not result["ok"] or not (result.get("content") or "").strip(): + print(f" \u274c LLM调用失败或空输出: {result.get('error') or 'empty content'}") return False full_text = result["content"]