fix: 任务抽屉产出结果优化 + server 启动修复
- 任务抽屉产出结果 tab 优先显示 last_message(日志消息), 过滤 result_data 中的 None/空值 - 修复 tasks.py 因 opencode 块删除导致的 SyntaxError - 修复 scheduled_generate 存储 None 值问题 - 清理 DB 中旧 scheduled_refresh_search_cache 的 56 条 TaskLog + 1 条 TaskConfig - 更新 PROGRESS.md
This commit is contained in:
@@ -252,19 +252,7 @@ def _get_module_detail_data(module_id: str, db, ROOT, DATA_DIR, LOGS_DIR, today_
|
||||
outputs = {}
|
||||
history = []
|
||||
|
||||
# try reading queries from yaml
|
||||
try:
|
||||
import yaml
|
||||
cfg_path = ROOT / "config" / "sources.yaml"
|
||||
if cfg_path.exists():
|
||||
cfg = yaml.safe_load(cfg_path.read_text(encoding="utf-8"))
|
||||
ws = cfg.get("sustainability_sources", {}).get("web_search", [])
|
||||
if ws:
|
||||
inputs["采集来源"] = f"config/sources.yaml ({len(ws)} 个搜索词)"
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif module_id == "scheduled_fetch_trends":
|
||||
if module_id == "scheduled_fetch_trends":
|
||||
trends_file = DATA_DIR / "trends.json"
|
||||
if trends_file.exists():
|
||||
try:
|
||||
|
||||
@@ -262,7 +262,7 @@ class TaskScheduler:
|
||||
logger.info("[Scheduled] Review completed for %s", created_id)
|
||||
_log_task("scheduled_generate", "success", log_id=log_id,
|
||||
message=f"创作完成" + (f", 选题 {created_id}" if created_id else ""),
|
||||
result_data={"topic_id": created_id, "review_ok": review_result.get("ok") if review_result else None},
|
||||
result_data={"topic_id": created_id} if created_id else {"note": "无待生成的选题"},
|
||||
started_at=started, finished_at=datetime.now(timezone.utc))
|
||||
except Exception as e:
|
||||
_log_task("scheduled_generate", "failed", log_id=log_id,
|
||||
|
||||
@@ -371,13 +371,18 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="📤 产出结果" name="outputs" style="overflow:auto;flex:1;">
|
||||
<div v-if="drawerData.result_data && Object.keys(drawerData.result_data).length > 0">
|
||||
<div v-for="(val, key) in drawerData.result_data" :key="key" style="margin-bottom:6px;font-size:13px;">
|
||||
<div v-if="drawerData.last_message" style="margin-bottom:12px;padding:10px 14px;background:#f0f9eb;border-radius:8px;font-size:13px;color:#529b2e;">
|
||||
<span style="font-weight:600;margin-right:6px;">状态消息:</span>{{ drawerData.last_message }}
|
||||
</div>
|
||||
<div v-if="drawerData.result_data && Object.keys(drawerData.result_data).filter(k => drawerData.result_data[k] !== null && drawerData.result_data[k] !== undefined).length > 0">
|
||||
<div style="font-size:13px;font-weight:600;margin-bottom:10px;color:#606266;">详细数据</div>
|
||||
<div v-for="(val, key) in drawerData.result_data" v-if="val !== null && val !== undefined" :key="key" style="margin-bottom:6px;font-size:13px;">
|
||||
<span style="color:#909399;">{{ key }}:</span>
|
||||
<span :style="{color: ['topics_count','articles_synced','processed','passed','topics_found'].includes(key) ? '#409eff' : '#606266', fontWeight: ['topics_count','articles_synced'].includes(key) ? '600' : '400'}">{{ val }}</span>
|
||||
<span v-if="typeof val === 'object'" style="color:#606266;">{{ JSON.stringify(val) }}</span>
|
||||
<span v-else :style="{color: ['topics_count','articles_synced','processed','passed','topics_found','marked_failed','reset_count','categories_assessed','sources_assessed'].includes(key) ? '#409eff' : '#606266', fontWeight: ['topics_count','articles_synced'].includes(key) ? '600' : '400'}">{{ val }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="color:#909399;padding:20px;text-align:center;">暂无产出数据</div>
|
||||
<div v-if="!drawerData.last_message && (!drawerData.result_data || Object.keys(drawerData.result_data).filter(k => drawerData.result_data[k] !== null && drawerData.result_data[k] !== undefined).length === 0)" style="color:#909399;padding:20px;text-align:center;">暂无产出数据</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="📋 运行记录" name="history" style="overflow:auto;flex:1;">
|
||||
<div v-if="drawerHistory && drawerHistory.length > 0">
|
||||
|
||||
Reference in New Issue
Block a user