From fb8c3cb6f4b64f17319ff93b42c4d5f01e14b50f Mon Sep 17 00:00:00 2001 From: ji ruo <79234113+RuoJi6@users.noreply.github.com> Date: Tue, 20 Oct 2026 11:43:24 +0800 Subject: [PATCH] fix: wrap intelligence table text and distinguish category colors --- web/src/components/intelligence-panel.tsx | 38 +++++++++++++++-------- web/src/lib/status.ts | 8 +++++ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/web/src/components/intelligence-panel.tsx b/web/src/components/intelligence-panel.tsx index cc91346..6a85f4a 100644 --- a/web/src/components/intelligence-panel.tsx +++ b/web/src/components/intelligence-panel.tsx @@ -7,6 +7,7 @@ import Link from "next/link"; import { CopyIcon, RefreshCwIcon } from "lucide-react"; import { toast } from "sonner"; +import { StatusBadge, ToneDot } from "@/components/status-badge"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; @@ -19,6 +20,7 @@ import { Skeleton } from "@/components/ui/skeleton"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { api } from "@/lib/api"; +import { statusMeta } from "@/lib/status"; import type { IntelligenceKind, IntelligencePage, TaskIntelligence } from "@/lib/types"; const KINDS: { value: IntelligenceKind; label: string }[] = [ @@ -146,6 +148,7 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets {KINDS.map((item) => ( + {item.label} {data?.counts[item.value] ?? 0} ))} @@ -197,7 +200,16 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets {!data && !error ? ( ) : data?.items.length ? ( - +
+ + + + + + + + + 类别 / 标题 @@ -212,14 +224,14 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets {data.items.map((item) => ( - -
- {KINDS.find((k) => k.value === item.kind)?.label} - {item.title} + +
+ + {item.title}
- -
+ +
                           {prettyContent(item.content)}
                         
@@ -229,7 +241,7 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets
- +
{STATUS[item.kind][item.status] ?? item.status} @@ -237,7 +249,7 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets
- +
任务 #{item.task_id} @@ -249,11 +261,11 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets {item.inherited ? 继承 · 只读 : null}
- + {item.asset_ids.length ? item.asset_ids.map((id) => `#${id}`).join("、") : "未关联"} - {time(item.created_at)} - + {time(item.created_at)} + @@ -308,7 +320,7 @@ export function IntelligencePanel({ scope, scopeId }: { scope: "tasks" | "assets {selected ? (
- {KINDS.find((k) => k.value === selected.kind)?.label} + {selected.confidence === "observed" ? "直接观察" : "推测"} 任务 #{selected.task_id} diff --git a/web/src/lib/status.ts b/web/src/lib/status.ts index eb15975..2593779 100644 --- a/web/src/lib/status.ts +++ b/web/src/lib/status.ts @@ -109,7 +109,15 @@ const delivery: Record = { skipped: { label: "已跳过", tone: "neutral" }, }; +// Intelligence category colors are shared by task, asset and detail views. +const intelligence: Record = { + credential: { label: "凭据", tone: "violet" }, + lead: { label: "重要线索", tone: "blue" }, + sensitive_data: { label: "敏感数据", tone: "amber" }, +}; + const maps = { + intelligence, intent, task, severity,