feat(admin): Agent监控/后台思考接WS实时 + 真流程图
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 新增 FlowGraph.tsx: SVG 自绘 DAG(分层布局/bezier边/箭头/按status着色,零新增依赖)
- Agents.tsx: 上下文查询接真后端(task_output_query→task_output);终止/重派诚实标需后端M10+,绝不伪造
- Backthink.tsx: 链路导图接 FlowGraphView;干预诚实标需后端M10+
- 控制项一律 useAuditStore.log 记 ok/error,未接入不伪造成功
This commit is contained in:
Aska committed 2026-09-07 02:57:41 +08:00
1 parent 4ad1e465da
commit ba8ff835cd
3 files changed
+290 -21

No files matched your search

+17 -6
View File
@@ -5,9 +5,11 @@ import { Notice, PageHeader } from "../components";
import { Button, EmptyState, Surface, Tag } from "../../components/primitives";
import type { BackthinkItem } from "../../lib/types";
import { Icon } from "../../components/Icon";
import { FlowGraphView } from "./FlowGraph";
function BackthinkRow({ item }: { item: BackthinkItem }): React.ReactNode {
const markPushed = useAppStore((s) => s.markBackthinkPushed);
const flowGraph = useAppStore((s) => s.flowGraph);
const [open, setOpen] = useState(false);
return (
@@ -35,9 +37,13 @@ function BackthinkRow({ item }: { item: BackthinkItem }): React.ReactNode {
{open ? "收起链路" : "查看完整链路导图"}
</button>
{open ? (
<div className="rounded-[var(--mu-radius-lg)] border border-dashed border-[var(--mu-glass-border)] px-4 py-8 text-center text-xs text-[var(--mu-text-lo)]">
链路导图占位 —— 后端 M10+ 提供思维链 / 流程图(graph_update 事件已接入实时通道)。
</div>
flowGraph ? (
<FlowGraphView graph={flowGraph} />
) : (
<div className="rounded-[var(--mu-radius-lg)] border border-dashed border-[var(--mu-glass-border)] px-4 py-8 text-center text-xs text-[var(--mu-text-lo)]">
暂无链路导图数据 —— 等待 graph_update 事件。
</div>
)
) : null}
</Surface>
);
@@ -47,6 +53,7 @@ export function BackthinkModule(): React.ReactNode {
const backthink = useAppStore((s) => s.backthink);
const log = useAuditStore((s) => s.log);
const [filter, setFilter] = useState<"all" | "notify" | "silent">("all");
const [interveneHint, setInterveneHint] = useState(false);
const items = backthink.filter((b) => {
if (filter === "notify") return b.shouldNotify === true;
@@ -63,8 +70,8 @@ export function BackthinkModule(): React.ReactNode {
<Button
variant="soft"
onClick={() => {
log("backthink.intervene", "ok");
alert("干预(占位):后端 M10+ 提供打断/重派。");
log("backthink.intervene", "error");
setInterveneHint(true);
}}
>
干预
@@ -72,6 +79,10 @@ export function BackthinkModule(): React.ReactNode {
}
/>
{interveneHint ? (
<Notice tone="warn">对后台思考的打断 / 重派需后端 M10+ 能力接入,当前未启用;此处仅展示已产生的思考记录。</Notice>
) : null}
<div className="flex items-center gap-2">
<FilterPill active={filter === "all"} onClick={() => setFilter("all")}>全部</FilterPill>
<FilterPill active={filter === "notify"} onClick={() => setFilter("notify")}>需打扰</FilterPill>
@@ -88,7 +99,7 @@ export function BackthinkModule(): React.ReactNode {
</div>
)}
<Notice>数据源:/ws/chat 下行 backthink / thinking 事件(实时);导图与干预为后端 M10+ 提供。</Notice>
<Notice>数据源:/ws/chat 下行 backthink / thinking 与 graph_update 事件(实时)。干预为后端 M10+ 提供,当前为只读展示。</Notice>
</div>
);
}