fix: 仪表盘概览标题颜色过浅改用CSS变量;模块状态列表从3个扩展至6个与定时任务数匹配
This commit is contained in:
@@ -185,25 +185,17 @@ def get_scheduler_status():
|
||||
@router.get("/modules/status", dependencies=[Depends(get_current_user)])
|
||||
def get_modules_status():
|
||||
today_str = date.today().isoformat()
|
||||
module_logs = {
|
||||
"creator": {
|
||||
"key": "🤖 内容创作引擎",
|
||||
"log": LOGS_DIR / f"creator_{today_str}.log",
|
||||
"config_file": PROJECT_ROOT / "automation" / "data" / "outlines" / today_str,
|
||||
},
|
||||
"optimizer": {
|
||||
"key": "🔍 内容优化器",
|
||||
"log": LOGS_DIR / f"optimizer_{today_str}.log",
|
||||
"config_file": PROJECT_ROOT / "automation" / "data" / "drafts" / today_str,
|
||||
},
|
||||
"collector": {
|
||||
"key": "📡 内容收集器",
|
||||
"log": LOGS_DIR / f"collector_{today_str}.log",
|
||||
"config_file": PROJECT_ROOT / "automation" / "data",
|
||||
},
|
||||
log_based: dict = {
|
||||
"scheduled_collect": {"name": "📡 内容采集", "log": LOGS_DIR / f"collector_{today_str}.log"},
|
||||
"scheduled_sync": {"name": "🔄 指标同步", "log": LOGS_DIR / f"sync_{today_str}.log"},
|
||||
"scheduled_generate": {"name": "🤖 内容创作", "log": LOGS_DIR / f"creator_{today_str}.log"},
|
||||
"scheduled_optimize": {"name": "🔍 内容优化", "log": LOGS_DIR / f"optimizer_{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"},
|
||||
}
|
||||
jobs = {j.id: j for j in scheduler.get_jobs()}
|
||||
modules = []
|
||||
for mod_id, cfg in module_logs.items():
|
||||
for mod_id, cfg in log_based.items():
|
||||
log_file = cfg["log"]
|
||||
last_run = None
|
||||
task_count = 0
|
||||
@@ -215,10 +207,11 @@ def get_modules_status():
|
||||
task_count = content.count("完成") + content.count("success") + content.count("SUCCESS")
|
||||
total = task_count + content.count("失败") + content.count("failed") + content.count("ERROR")
|
||||
success_rate = round(task_count / total * 100) if total > 0 else None
|
||||
status = "running" if log_file.exists() else ("idle" if mod_id in jobs else "stopped")
|
||||
modules.append({
|
||||
"id": mod_id,
|
||||
"title": cfg["key"],
|
||||
"status": "running" if log_file.exists() else "stopped",
|
||||
"title": cfg["name"],
|
||||
"status": status,
|
||||
"last_run": last_run or "从未运行",
|
||||
"task_count": task_count,
|
||||
"success_rate": success_rate,
|
||||
|
||||
Reference in New Issue
Block a user