You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
2.1 KiB

const REGION_LABEL = {
1: "中国",
2: "美国",
3: "东亚",
4: "东南亚",
5: "南亚",
6: "中东",
7: "欧洲",
8: "俄罗斯",
9: "非洲",
10: "南美",
11: "北美",
12: "大洋洲",
13: "巴西",
14: "印度"
};
const CAT_LABEL = {
1: "STT",
2: "TTS",
3: "MT",
4: "AST",
5: "文本LLM",
6: "存储",
7: "STS",
8: "录音识别",
9: "多媒体LLM",
10: "MCP"
};
const STATUS_META = {
error: { label: "不可用", color: "#be123c", bg: "#ffe4e6" },
warn: { label: "有隐患", color: "#b45309", bg: "#fef3c7" },
ok: { label: "正常", color: "#047857", bg: "#d1fae5" },
skip: { label: "已停用", color: "#64748b", bg: "#f1f5f9" }
};
const PROBE_META = {
credential: { label: "凭据已验证", hint: "已用真实凭据调通服务商接口" },
reachable: { label: "仅连通性", hint: "地址可达,但未验证凭据是否有效" },
none: { label: "未探测", hint: "暂无该服务商的探针,可用性未经验证" }
};
function healthReason(h) {
const issues = h.config_issues || [];
const fatal = issues.filter((s) => s.startsWith("[致命] "));
if (fatal.length) return fatal.map((s) => s.replace("[致命] ", "")).join(";");
if (h.status === "error") return h.probe_msg || "巡检失败";
if (issues.length) return issues.join(";");
if (h.probe_kind === "none") return h.probe_msg || "未验证可用性";
return h.probe_msg || "";
}
function healthLastRunText(ms) {
if (!ms) return "尚未执行";
const diff = Date.now() - ms;
if (diff < 6e4) return "刚刚";
if (diff < 36e5) return `${Math.floor(diff / 6e4)} 分钟前`;
if (diff < 864e5) return `${Math.floor(diff / 36e5)} 小时前`;
return new Date(ms).toLocaleString("zh-CN", { hour12: false });
}
function parseCats(categories) {
return (categories || "").split(",").map((s) => Number(s.trim())).filter((n) => !Number.isNaN(n) && n > 0);
}
export { CAT_LABEL as C, PROBE_META as P, REGION_LABEL as R, STATUS_META as S, healthReason as a, healthLastRunText as h, parseCats as p };
//# sourceMappingURL=svchealth-8zW8U1Ef.mjs.map