fix: 小红书文章无正常内容(LLM推理文本污染)、模块列表不匹配、脚本独立运行缺org_id列迁移
This commit is contained in:
@@ -193,7 +193,7 @@ def get_modules_status():
|
||||
"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"},
|
||||
}
|
||||
jobs = {j.id: j for j in scheduler.get_jobs()}
|
||||
jobs = {j['id']: j for j in scheduler.get_jobs()}
|
||||
modules = []
|
||||
for mod_id, cfg in log_based.items():
|
||||
log_file = cfg["log"]
|
||||
|
||||
@@ -110,7 +110,8 @@ def call_llm(
|
||||
if resp.status_code != 200:
|
||||
raise LLMError(f"HTTP {resp.status_code}: {resp.text[:200]}")
|
||||
if stream:
|
||||
full = []
|
||||
content_parts = []
|
||||
reasoning_parts = []
|
||||
for line in resp.iter_lines():
|
||||
if not line: continue
|
||||
if line.startswith(b'data: '):
|
||||
@@ -119,12 +120,14 @@ def call_llm(
|
||||
try:
|
||||
chunk = json.loads(data)
|
||||
delta = chunk['choices'][0]['delta']
|
||||
if delta.get('reasoning_content'):
|
||||
full.append(delta['reasoning_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
|
||||
return "".join(full)
|
||||
if content_parts:
|
||||
return "".join(content_parts)
|
||||
return "".join(reasoning_parts)
|
||||
else:
|
||||
data = resp.json()
|
||||
msg = data["choices"][0]["message"]
|
||||
|
||||
Reference in New Issue
Block a user