fix: 小红书文章无正常内容(LLM推理文本污染)、模块列表不匹配、脚本独立运行缺org_id列迁移

This commit is contained in:
Yuzhiran Dev
2026-05-17 22:52:05 +08:00
parent eb472d232e
commit dc531460ea
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ def get_modules_status():
"scheduled_optimize_sources": {"name": "📡 信息源优化", "log": LOGS_DIR / f"optimizer_sources_{today_str}.log"}, "scheduled_optimize_sources": {"name": "📡 信息源优化", "log": LOGS_DIR / f"optimizer_sources_{today_str}.log"},
"scheduled_metrics_sync": {"name": "📊 指标同步", "log": LOGS_DIR / f"metrics_sync_{today_str}.log"}, "scheduled_metrics_sync": {"name": "📊 指标同步", "log": LOGS_DIR / f"metrics_sync_{today_str}.log"},
} }
jobs = {j.id: j for j in scheduler.get_jobs()} jobs = {j['id']: j for j in scheduler.get_jobs()}
modules = [] modules = []
for mod_id, cfg in log_based.items(): for mod_id, cfg in log_based.items():
log_file = cfg["log"] log_file = cfg["log"]
+8 -5
View File
@@ -110,7 +110,8 @@ def call_llm(
if resp.status_code != 200: if resp.status_code != 200:
raise LLMError(f"HTTP {resp.status_code}: {resp.text[:200]}") raise LLMError(f"HTTP {resp.status_code}: {resp.text[:200]}")
if stream: if stream:
full = [] content_parts = []
reasoning_parts = []
for line in resp.iter_lines(): for line in resp.iter_lines():
if not line: continue if not line: continue
if line.startswith(b'data: '): if line.startswith(b'data: '):
@@ -119,12 +120,14 @@ def call_llm(
try: try:
chunk = json.loads(data) chunk = json.loads(data)
delta = chunk['choices'][0]['delta'] delta = chunk['choices'][0]['delta']
if delta.get('reasoning_content'):
full.append(delta['reasoning_content'])
if delta.get('content'): if delta.get('content'):
full.append(delta['content']) content_parts.append(delta['content'])
if delta.get('reasoning_content'):
reasoning_parts.append(delta['reasoning_content'])
except Exception: continue except Exception: continue
return "".join(full) if content_parts:
return "".join(content_parts)
return "".join(reasoning_parts)
else: else:
data = resp.json() data = resp.json()
msg = data["choices"][0]["message"] msg = data["choices"][0]["message"]