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:
Yuzhiran Dev
2026-06-03 11:06:25 +08:00
parent 499c511140
commit c6628b22f6
4 changed files with 12 additions and 18 deletions
+1
View File
@@ -153,6 +153,7 @@
| 合规审查修复 | 2026-05-28 | compliance_optimizer.py 移除硬编码 provider;补 import os(之前导致 NameError);关键词过滤从宽泛改为精准,避免误拦正常内容 |
| 搜索提供商重构 | 2026-05-28 | 移除 opencode MCP(配额耗尽),新增 360/搜狗/微信搜索(免 Key),百度千帆日限 50→200 |
| opencode 冗余代码清理 | 2026-06-02 | 删除 opencode_search.py / mcp_search_server.py / _call_mcp / 前后端所有 opencode/MCP 引用;禁用搜索缓存定时任务 |
| 任务抽屉产出记录优化 | 2026-06-03 | drawer 产出结果 tab 优先显示日志消息(last_message),过滤 None/空值;修复 tasks.py 因 opencode 清理导致的 SyntaxError;清理 DB 中旧搜索缓存的 56 条 TaskLog + 1 条 TaskConfig |
### ⏳ 待办
+1 -13
View File
@@ -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:
+1 -1
View File
@@ -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,
+9 -4
View File
@@ -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">