fix(organize): 展示智能体处理状态并刷新恢复结果

This commit is contained in:
root committed 2026-10-13 15:38:24 +08:00
1 parent 86351f20f3
commit b306d27d08
9 files changed
+172 -12

No files matched your search

@@ -1,8 +1,15 @@
import type { Decision, EpisodeMappingPreview } from "@umt/contracts";
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { MemoryRouter } from "react-router";
import { describe, expect, it } from "vitest";
import { agentSimulationText, EpisodeDecisionBody, episodeDecisionView, simulationText } from "./decision.tsx";
import {
agentSimulationText,
EpisodeDecisionBody,
EpisodeDecisionStatus,
episodeDecisionView,
simulationText,
} from "./decision.tsx";
const ENTITY = "7d3f7f5e-8a8c-4b8e-9f0a-1b2c3d4e5f60";
const decision = (over: Partial<Decision> = {}): Decision =>
@@ -155,3 +162,27 @@ describe("待处理「集数待确认」", () => {
);
});
});
describe("季集映射调查状态", () => {
const renderStatus = (d: Decision) =>
renderToStaticMarkup(createElement(MemoryRouter, null, createElement(EpisodeDecisionStatus, { d })));
it("调查中显示状态与已有会话入口,没有会话也能显示进度", () => {
const html = renderStatus(decision({ status: "investigating", agentRunId: "agent-run" }));
expect(html).toContain("智能体正在核对季集");
expect(html).toContain("/console/agent/agent-run");
expect(renderStatus(decision({ status: "investigating", agentRunId: null }))).toContain("智能体正在核对季集");
});
it("交还人工显示恢复建议,并保留排查入口", () => {
const html = renderStatus(
decision({
status: "awaiting_user",
agentRunId: "agent-run",
evidence: { autoRecover: { suggestion: "请补充资源站分季详情" } },
}),
);
expect(html).toContain("需要你确认");
expect(html).toContain("请补充资源站分季详情");
expect(html).toContain("查看排查过程");
expect(renderStatus(decision())).toBe("");
});
});