feat: LLM并发模式统一——batch_reassess/trade_capture加concurrent=True(盘前批量4worker不再全压同一key,router round-robin分key), parallel_batch worker 4→6(6 key用满)

This commit is contained in:
xxm
2026-08-24 16:47:37 +08:00
parent 5a2319cd90
commit 131d434079
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -998,7 +998,7 @@ def process_stock(code, force_today=False):
prompt = build_prompt(data)
# ── 使用共享 LLM 客户端(替代 curl subprocess)──
result = call_llm(prompt, model=REASSESS_MODEL, max_tokens=None) # 文档: 推理模型不指定max_tokens
result = call_llm(prompt, model=REASSESS_MODEL, max_tokens=None, concurrent=True) # 2026-08-24 并发模式: router round-robin分key(4worker不再全压同一key)
if not result["ok"] or not (result.get("content") or "").strip():
print(f" \u274c LLM调用失败或空输出: {result.get('error') or 'empty content'}")
@@ -1012,7 +1012,7 @@ def process_stock(code, force_today=False):
# ── 截断保护:输出过短且无信号 = 低质输出,升级 pro 重试一次 ──
if not parsed.get("signal") and len(full_text) < 1500:
print(f" ⚠️ 输出截断({len(full_text)}字)且无信号,升级 {FALLBACK_MODEL} 重试...", flush=True)
result2 = call_llm(prompt, model=FALLBACK_MODEL, max_tokens=None) # 文档: 推理模型不指定max_tokens
result2 = call_llm(prompt, model=FALLBACK_MODEL, max_tokens=None, concurrent=True) # 2026-08-24 并发模式
if result2["ok"] and len((result2.get("content") or "").strip()) > len(full_text):
full_text = result2["content"]
parsed = parse_response(full_text)
+1 -1
View File
@@ -2,7 +2,7 @@
# parallel_batch.sh — 并发批量12维重评(分片+key池偏移+统一flush)
# 用法: bash parallel_batch.sh [N] [type]
# N=worker数(默认4) type=holding|watchlist|all(默认all)
N=${1:-4}
N=${1:-6} # 2026-08-24 4→6: OCG router 6 key 用满(concurrent=True round-robin防撞)
TYPE=${2:-all}
cd /home/hmo/MoFin/deploy/profile-scripts
echo "[parallel] launching $N workers (type=$TYPE) at $(date '+%F %T')"
+1 -1
View File
@@ -179,7 +179,7 @@ def process_screenshot(ocr_text):
【成本价】数字(有持仓时填写)
"""
result = call_llm(prompt, model=REASSESS_MODEL, max_tokens=None)
result = call_llm(prompt, model=REASSESS_MODEL, concurrent=True, max_tokens=None)
if not result["ok"] or not result.get("content"):
return {"ok": False, "error": "LLM调用失败"}