From 34675f16a8454708ae52084b34278d403de18eb5 Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Mon, 7 Sep 2026 10:32:17 +0000 Subject: [PATCH] =?UTF-8?q?style:=20=E5=8E=BB=E6=8E=89=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E8=AF=AD=E6=B3=95,=20=E6=98=8E=E7=BB=86=E6=94=B9=E6=99=AE?= =?UTF-8?q?=E9=80=9A=E8=A1=8C(=E4=BC=81=E5=BE=AE=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E8=A1=8C=E6=B8=B2=E6=9F=93=E7=B2=98=E8=BF=9E?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flows/monitor/alert_failure.py | 8 ++++---- flows/monitor/daily_report.py | 8 ++++---- flows/monitor/device_check.py | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/flows/monitor/alert_failure.py b/flows/monitor/alert_failure.py index 14e8058..b9b9948 100644 --- a/flows/monitor/alert_failure.py +++ b/flows/monitor/alert_failure.py @@ -104,14 +104,14 @@ def wecom_alert_failure(event: dict | str | None = None) -> dict: lines = [f"## 流程失败:{flow_name or resource_name or '未知'}"] if run_name: - lines.append(f"> Run {run_name} · {event_name.split('.')[-1]} · {_fmt_ts(occurred)}") + lines.append(f"Run {run_name} · {event_name.split('.')[-1]} · {_fmt_ts(occurred)}") if state_msg: - lines.append(f'> 错误:{state_msg[:150].replace(chr(10), " ")}') + lines.append(f'错误:{state_msg[:150].replace(chr(10), " ")}') if run_id: - lines.append(f"> [查看详情]({UI_BASE}/runs/flow-run/{run_id})") + lines.append(f"[查看详情]({UI_BASE}/runs/flow-run/{run_id})") else: raw = json.dumps(ev, ensure_ascii=False)[:300] if ev else "(事件内容解析失败)" - lines.append(f"> 原始事件:{raw}") + lines.append(f"原始事件:{raw}") result["sent"] = send_markdown("\n".join(lines)) result.update({"flowName": flow_name or None, "runId": run_id}) diff --git a/flows/monitor/daily_report.py b/flows/monitor/daily_report.py index 7e078b1..f020f36 100644 --- a/flows/monitor/daily_report.py +++ b/flows/monitor/daily_report.py @@ -6,7 +6,7 @@ 2. OCR:今天处理了多少订单、识别失败多少(按 ocrProcessedAt 盖章统计)。 3. 失败任务:近 24h 哪些 workflow、哪些 run、失败几次、何时失败(事件报警的兜底汇总)。 -消息排版遵循 WeCom aibot markdown 子集(无表格、无 font 标签,引用块 + emoji)。 +排版:标题 + 单行结论 + 普通明细行,状态用 三色文字表达,不用 emoji/引用/表格。 """ from __future__ import annotations @@ -50,7 +50,7 @@ def _system_lines(name: str, report: dict, goods: dict, lines: list[str]) -> boo diff_days = [d for d in days_r if not d.get("ok")] diff_units = sum(_affected_units(d.get("diff")) for d in diff_days) if diff_units: - lines.append(f"> 状态不符约 {diff_units:,} 单({len(diff_days)} 天),已自动刷新修复") + lines.append(f"状态不符约 {diff_units:,} 单({len(diff_days)} 天),已自动刷新修复") return (not ok) or bool(zero) @@ -81,9 +81,9 @@ def build_daily_message( lines.append(f'**任务** 失败 {len(failures)} 次(24h)') for f in failures[:6]: start = (f.get("start") or "")[5:] # MM-DD HH:MM - lines.append(f"> {f.get('flow', '?')}:{f.get('name', '?')} {f.get('state', '?')} {start}") + lines.append(f"{f.get('flow', '?')}:{f.get('name', '?')} {f.get('state', '?')} {start}") if len(failures) > 6: - lines.append(f"> …等共 {len(failures)} 次") + lines.append(f"…等共 {len(failures)} 次") else: lines.append("**任务** 失败 0 次(24h)") diff --git a/flows/monitor/device_check.py b/flows/monitor/device_check.py index 107b710..4c71d70 100644 --- a/flows/monitor/device_check.py +++ b/flows/monitor/device_check.py @@ -380,7 +380,7 @@ def device_check(alarm_threshold: int = 80) -> dict: for m in mounts: g = growth.get(label_map.get(m["label"], "")) growth_txt = f" · 增长最快 {g['dir']} {_fmt_growth(g['growth'])}" if g and g.get("dir") else "" - lines.append(f"> {m['label']} {_mark(m['pct'], threshold)} · 已用 {_gb(m['used'])} · 剩 {_gb(m['free'])}{growth_txt}") + lines.append(f"{m['label']} {_mark(m['pct'], threshold)} · 已用 {_gb(m['used'])} · 剩 {_gb(m['free'])}{growth_txt}") # ---- GPU ---- gpu_stats = agg.get("gpus") or [] @@ -427,15 +427,15 @@ def device_check(alarm_threshold: int = 80) -> dict: docker_txt += " · PG " + ("正常" if svc.get("pg") else '异常') lines.append(f"**Docker** {docker_txt}") for it in issues[:8]: - lines.append(f"> {it['name']}:{it['issue']}") + lines.append(f"{it['name']}:{it['issue']}") failures = checks.get("prefectFailures") or [] if failures: lines.append(f'**任务** 失败 {len(failures)} 次(24h)') for f in failures[:5]: - lines.append(f"> {f['flow']}:{f['name']} {f['state']} {(f.get('start') or '')[5:]}") + lines.append(f"{f['flow']}:{f['name']} {f['state']} {(f.get('start') or '')[5:]}") if len(failures) > 5: - lines.append(f"> …共 {len(failures)} 次") + lines.append(f"…共 {len(failures)} 次") else: lines.append("**任务** 失败 0 次(24h)")