8bcb90cdb2
管理端新增「运维 › 服务状态」:总览横幅 + 摘要数字 + 请求链路拓扑 (客户端→网关→NATS→调度→MCP,按健康三态着色)+ 应用服务卡(含探针 延迟)+ 基建磁贴 + MCP 工具按能力域分组(中文名/作用)。 探活机制(全走 NATS,无 HTTP): - mcp-go/mcp-py 新增 list_tools 自省工具,能应答=在线 + 上报工具清单 - dispatcher 无端点 → 新增 NATS 心跳主题 sundynix.health.dispatcher (ServeHealth 应答 model/ready/uptime),网关用 bus.Ping 探 - 网关 GET /api/v1/admin/status 并发聚合四探针 + 各项延迟 mcp-go 重构:switch → map 注册表(buildRegistry),dispatch 与 list_tools 共用单一事实源,杜绝漂移;每个工具带中文名 + 作用描述。mcp-py 同样补元信息。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
import { lazy, type ReactNode } from "react";
|
|
import { Soon } from "./components/Soon";
|
|
|
|
// 路由注册表 —— 控制台的单一事实源:导航 + 内容都从这里派生。
|
|
// 新增页面 = 在此加一条;real 页面用 lazy 懒加载(代码分割)。
|
|
const ModelsPage = lazy(() => import("./pages/ModelsPage").then((m) => ({ default: m.ModelsPage })));
|
|
const DatasourcesPage = lazy(() => import("./pages/DatasourcesPage").then((m) => ({ default: m.DatasourcesPage })));
|
|
const PricingPage = lazy(() => import("./pages/PricingPage").then((m) => ({ default: m.PricingPage })));
|
|
const StatusPage = lazy(() => import("./pages/StatusPage").then((m) => ({ default: m.StatusPage })));
|
|
|
|
export interface RouteDef {
|
|
path: string;
|
|
label: string;
|
|
group: string;
|
|
ready?: boolean;
|
|
element: ReactNode;
|
|
}
|
|
|
|
export const routes: RouteDef[] = [
|
|
{
|
|
path: "/models",
|
|
label: "模型",
|
|
group: "配置",
|
|
ready: true,
|
|
element: <ModelsPage />,
|
|
},
|
|
{
|
|
path: "/datasources",
|
|
label: "数据源",
|
|
group: "配置",
|
|
ready: true,
|
|
element: <DatasourcesPage />,
|
|
},
|
|
{
|
|
path: "/pricing",
|
|
label: "计价",
|
|
group: "配置",
|
|
ready: true,
|
|
element: <PricingPage />,
|
|
},
|
|
{
|
|
path: "/status",
|
|
label: "服务状态",
|
|
group: "运维",
|
|
ready: true,
|
|
element: <StatusPage />,
|
|
},
|
|
{
|
|
path: "/tenants",
|
|
label: "租户",
|
|
group: "平台",
|
|
element: <Soon title="租户 / 工作区" desc="多租户隔离、配额、用户与计费。垂直行业平台级复制的基座。" />,
|
|
},
|
|
{
|
|
path: "/guardrails",
|
|
label: "护栏",
|
|
group: "平台",
|
|
element: <Soon title="护栏" desc="输入/输出 Guardrail 规则(脱敏 / 免责 / 强制引用)。受监管垂直必备。" />,
|
|
},
|
|
];
|
|
|
|
export const defaultPath = "/models";
|
|
|
|
// 派生分组导航(保持注册顺序)。
|
|
export function navGroups(): Array<{ group: string; items: RouteDef[] }> {
|
|
const out: Array<{ group: string; items: RouteDef[] }> = [];
|
|
for (const r of routes) {
|
|
let g = out.find((x) => x.group === r.group);
|
|
if (!g) {
|
|
g = { group: r.group, items: [] };
|
|
out.push(g);
|
|
}
|
|
g.items.push(r);
|
|
}
|
|
return out;
|
|
}
|