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"]