-
{/* Left: key metrics */}
{/* Total */}
@@ -620,9 +651,7 @@ export default function DashboardPage() {
{fmtTokens(displayedTokens.input + displayedTokens.output) || "—"}
-
- {displayedTokens.taskCount} 个任务
-
+
{displayedTokens.taskCount} 个任务
{/* Per-type bars */}
@@ -631,18 +660,31 @@ export default function DashboardPage() {
// input 已含缓存;拆成不重叠三段:未命中输入 + 缓存命中 + 输出 = 总量。
const total = displayedTokens.input + displayedTokens.output;
return [
- { label: "输入(未命中)", value: displayedTokens.input - displayedTokens.cacheRead, barColor: dailyTrendConfig.input.color!, text: "text-blue-400" },
- { label: "缓存命中", value: displayedTokens.cacheRead, barColor: dailyTrendConfig.cacheRead.color!, text: "text-emerald-400" },
- { label: "输出", value: displayedTokens.output, barColor: dailyTrendConfig.output.color!, text: "text-violet-400" },
+ {
+ label: "输入(未命中)",
+ value: displayedTokens.input - displayedTokens.cacheRead,
+ barColor: dailyTrendConfig.input.color!,
+ text: "text-blue-400",
+ },
+ {
+ label: "缓存命中",
+ value: displayedTokens.cacheRead,
+ barColor: dailyTrendConfig.cacheRead.color!,
+ text: "text-emerald-400",
+ },
+ {
+ label: "输出",
+ value: displayedTokens.output,
+ barColor: dailyTrendConfig.output.color!,
+ text: "text-violet-400",
+ },
].map(({ label, value, barColor, text }) => {
const pct = total > 0 ? (value / total) * 100 : 0;
return (
{label}
-
- {fmtTokens(value)}
-
+ {fmtTokens(value)}
缓存命中率
- 50 ? "text-emerald-400" : "text-amber-400")}>
+ 50 ? "text-emerald-400" : "text-amber-400")}
+ >
{hitPct}%
@@ -687,14 +731,17 @@ export default function DashboardPage() {
))}
- {([
- { days: 7, label: "7天" },
- { days: 30, label: "30天" },
- { days: 90, label: "3月" },
- { days: 180, label: "6月" },
- { days: 365, label: "一年" },
- ] as const).map(({ days, label }) => (
+ {(
+ [
+ { days: 7, label: "7天" },
+ { days: 30, label: "30天" },
+ { days: 90, label: "3月" },
+ { days: 180, label: "6月" },
+ { days: 365, label: "一年" },
+ ] as const
+ ).map(({ days, label }) => (
{dailyTokenData.length === 0 ? (
-
+
暂无数据
) : (
-
+
(
- {(dailyTrendConfig as Record)[String(name)]?.label ?? String(name)}
-
- {fmtTokens(Number(value))}
+
+ {(dailyTrendConfig as Record)[String(name)]?.label ??
+ String(name)}
+ {fmtTokens(Number(value))}
)}
/>
}
/>
-
-
+
+
@@ -765,7 +812,6 @@ export default function DashboardPage() {
{/* ── Row 3: 活动流 | 发现 ── */}
-
{/* 活动流 */}
@@ -787,27 +833,20 @@ export default function DashboardPage() {
- {(["tool_use", "tool_result", "text", "thinking", "result"] as const).map(
- (kind) => {
- const count = activity.filter((a) => a.kind === kind).length;
- if (count === 0) return null;
- return (
-
- {kind} {count}
-
- );
- },
- )}
+ {(["tool_use", "tool_result", "text", "thinking", "result"] as const).map((kind) => {
+ const count = activity.filter((a) => a.kind === kind).length;
+ if (count === 0) return null;
+ return (
+
+ {kind} {count}
+
+ );
+ })}
{recentActivity.length === 0 ? (
-
- 暂无活动记录
-
+
暂无活动记录
) : (
recentActivity.map((a) => (
@@ -821,20 +860,13 @@ export default function DashboardPage() {
{kindLabel(a)}
-
- {a.summary}
-
+
{a.summary}
-
+
{a.kind}
-
- {fmtRel(a.ts)}
-
+ {fmtRel(a.ts)}
))
@@ -859,9 +891,7 @@ export default function DashboardPage() {
{recentFindings.length === 0 ? (
-
- 暂无发现
-
+
暂无发现
) : (
recentFindings.map((f) => (
@@ -874,18 +904,14 @@ export default function DashboardPage() {
{f.vulnclass}
{f.task_description && (
-
- {f.task_description}
-
+ {f.task_description}
)}
{f.summary}
-
- {fmtRel(f.ts)}
-
+
{fmtRel(f.ts)}
))
)}
@@ -901,9 +927,7 @@ export default function DashboardPage() {
任务
-
- {tasks.length} 个任务
-
+
{tasks.length} 个任务
- {["任务", "状态", "引擎", "目标进度", "在途", "最近活动"].map(
- (h) => (
- |
- {h}
- |
- ),
- )}
+ {["任务", "状态", "引擎", "目标进度", "在途", "最近活动"].map((h) => (
+
+ {h}
+ |
+ ))}
{sortedTasks.length === 0 ? (
- |
+ |
暂无任务
|
) : (
sortedTasks.map((t) => {
- const goalsPct = t.goals_total
- ? Math.round(((t.goals_met ?? 0) / t.goals_total) * 100)
- : null;
+ const goalsPct = t.goals_total ? Math.round(((t.goals_met ?? 0) / t.goals_total) * 100) : null;
return (
-
+
|
-
-
- {t.description}
-
-
- {t.id}
-
+
+ {t.description}
+ {t.id}
|
@@ -983,7 +990,7 @@ export default function DashboardPage() {
)}
|
- {t.in_flight ?? 0 > 0 ? (
+ {(t.in_flight ?? 0) > 0 ? (
{t.in_flight}
) : (
—
@@ -1002,7 +1009,6 @@ export default function DashboardPage() {
{/* ── Row 5: 资产分布 | 流量状态码 | 拦截 & 待审批 ── */}
-
{/* 资产分布 */}
@@ -1010,9 +1016,7 @@ export default function DashboardPage() {
{assetByType.length === 0 ? (
-
- 暂无资产数据
-
+ 暂无资产数据
) : (
{assetByType.map(([type, count]) => (
@@ -1032,9 +1036,7 @@ export default function DashboardPage() {
)}
-
- 共 {totalAssets} 节点
-
+ 共 {totalAssets} 节点
{/* 流量状态码 */}
@@ -1045,36 +1047,24 @@ export default function DashboardPage() {
{/* bar chart */}
{trafficByCodes.length === 0 ? (
-
- 暂无流量数据
-
+ 暂无流量数据
) : (
<>
{trafficByCodes.map(({ code, n }) => (
-
- {n}
-
+ {n}
-
- {code}
-
+ {code}
))}
-
- 最近请求
-
+ 最近请求
{recentTraffic.map((e) => (
@@ -1092,14 +1082,7 @@ export default function DashboardPage() {
{e.host}
{e.url.replace(/^https?:\/\/[^/]+/, "").substring(0, 30)}
-
- {e.status}
-
+ {e.status}
))}
@@ -1154,9 +1137,7 @@ export default function DashboardPage() {
{/* pending approvals */}
{pendingCount > 0 && (
-
- 待审批 ({pendingCount})
-
+ 待审批 ({pendingCount})
{pending.slice(0, 3).map((p) => (
{p.tool_name}
-
- {p.agent_name}
-
+ {p.agent_name}
|