fix: 功能树只显示position-analyst(知微)的cron,default(莫荷)的cron不混入

This commit is contained in:
知微
2026-07-08 17:25:08 +08:00
parent 5239f481b0
commit ab85173902
2 changed files with 19 additions and 7 deletions
+10 -2
View File
@@ -77,11 +77,13 @@ def load_cron_jobs():
jobs = []
seen = set()
for jf in CRON_FILES:
profile_tag = "position-analyst" if "position-analyst" in str(jf) else "default"
try:
for j in json.load(open(jf)).get("jobs", []):
jid = j.get("id", "")
if jid in seen: continue
seen.add(jid)
j["profile"] = profile_tag
jobs.append(j)
except: pass
return jobs
@@ -240,6 +242,7 @@ def build_feature_tree(cron_jobs, db_stats):
"status": j.get("last_status", "unknown"),
"last_run": (j.get("last_run_at", "") or "")[:16] if j.get("last_run_at") else "",
"type": "no_agent" if j.get("no_agent") else "LLM",
"profile": j.get("profile", "?"),
} for j in matched]
if pipes:
node["pipes"] = pipes
@@ -258,6 +261,7 @@ def build_feature_tree(cron_jobs, db_stats):
"status": j.get("last_status", "unknown"),
"last_run": (j.get("last_run_at", "") or "")[:16] if j.get("last_run_at") else "",
"type": "no_agent" if j.get("no_agent") else "LLM",
"profile": j.get("profile", "?"),
}]
}
@@ -365,8 +369,11 @@ def build_report():
flows = scan_data_flows()
script_health = check_scripts()
# ── 功能树 ──
feature_tree = build_feature_tree(cron_jobs, db_stats)
# ── 功能树(只显示知微的cron──
zhiwei_crons = [j for j in cron_jobs if j.get("profile") == "position-analyst" or j.get("name") in [
"cron-推XMPP中继", "数据同步-dashboard", "记忆守卫-每日", "市场数据采集"
]]
feature_tree = build_feature_tree(zhiwei_crons, db_stats)
# 递归计算节点状态
def calc_status(node):
if "children" in node:
@@ -435,6 +442,7 @@ def build_report():
"schedule": schedule,
"status": status,
"last_run": last_run,
"profile": j.get("profile", "?"),
})
# ── 写JSON ──