fix: 去掉 aibot 不支持的 font 标签,改加粗+emoji;补拉量合计格式化中文

This commit is contained in:
yeuimu
2026-08-28 02:02:18 +00:00
parent 14321faa91
commit 60e5ff404e
4 changed files with 27 additions and 15 deletions
+4 -5
View File
@@ -168,11 +168,11 @@ def _check_services() -> dict:
def _mark(pct: float | None, threshold: int) -> str:
"""百分比展示:WeCom markdown 不支持表格,超阈值用红色字体高亮。"""
"""百分比展示:超阈值加粗+🔴(WeCom aibot markdown 不支持 font 标签和表格)。"""
if pct is None:
return "—"
if pct >= threshold:
return f'<font color="warning">**{pct:.0f}%**</font>'
return f"**{pct:.0f}%**🔴"
return f"{pct:.0f}%"
@@ -227,7 +227,7 @@ def device_check(alarm_threshold: int = 80) -> dict:
if docker.get("stopped"):
docker_line += f" · 已停用 {docker['stopped']}"
if issues:
docker_line += f" · 异常 <font color=\"warning\">**{len(issues)}**</font>"
docker_line += f" · 异常 **{len(issues)}**🔴"
else:
docker_line += " · 异常 0"
lines.append(docker_line)
@@ -249,8 +249,7 @@ def device_check(alarm_threshold: int = 80) -> dict:
or (isinstance(gpus, list) and any(g["utilPct"] >= threshold or g["memPct"] >= threshold for g in gpus))
or bool(issues) or bool(failures) or not svc.get("ocr") or not svc.get("pg")
)
lines += ["", ('<font color="warning">🔴 **有项目需要处理,见上**</font>' if alarms
else '<font color="info">✅ **一切正常**</font>')]
lines += ["", ("🔴 **有项目需要处理,见上**" if alarms else "✅ **一切正常**")]
content = "\n".join(lines)
sent = send_markdown(content)