fix(organize): 展示智能体处理状态并刷新恢复结果
This commit is contained in:
1 parent
86351f20f3
commit
b306d27d08
9 files changed
+172
-12
No files matched your search
@@ -6,7 +6,7 @@ import type {
|
||||
EpisodeResultBrief,
|
||||
EpisodeSimulationSummary,
|
||||
} from "@umt/contracts";
|
||||
import { BellOff, Bot, Check, PencilLine } from "lucide-react";
|
||||
import { BellOff, Bot, Check, LoaderCircle, PencilLine } from "lucide-react";
|
||||
import { useId, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { toast } from "sonner";
|
||||
@@ -14,9 +14,11 @@ import { useResolveDecision } from "~/api/decisions.ts";
|
||||
import { useEntityWords, useEpisodeMappingPreview } from "~/api/episode-mapping.ts";
|
||||
import { ConfirmDialog } from "~/components/console/confirm-dialog.tsx";
|
||||
import { consolePath } from "~/components/console/nav.ts";
|
||||
import { StatusBadge } from "~/components/console/status-badge.tsx";
|
||||
import { Button } from "~/components/ui/button.tsx";
|
||||
import { Switch } from "~/components/ui/switch.tsx";
|
||||
import { errorMessage } from "~/lib/api.ts";
|
||||
import { humanizeReason } from "~/lib/reasons.ts";
|
||||
import { canonicalText, episodeCode, mappingHref, scopeText, sourceText } from "./model.ts";
|
||||
|
||||
// 作品页集数映射里的「集数待确认」(episode_mapping 内部事项):来源季集、原因、建议的那一行作品识别词与它的模拟结果;
|
||||
@@ -234,6 +236,33 @@ function IgnoreButton({ d, view }: { d: Decision; view: EpisodeDecisionView }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** 在原来的映射事项里显示智能体进度和交还人工的原因。 */
|
||||
export function EpisodeDecisionStatus({ d }: { d: Decision }) {
|
||||
const investigating = d.status === "investigating";
|
||||
const awaiting = d.status === "awaiting_user";
|
||||
if (!investigating && !awaiting) return null;
|
||||
const recovery = d.evidence.autoRecover as { suggestion?: unknown } | undefined;
|
||||
const suggestion = awaiting && typeof recovery?.suggestion === "string" ? recovery.suggestion : d.summary;
|
||||
return (
|
||||
<div className="space-y-1.5">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<StatusBadge tone={awaiting ? "warning" : "neutral"}>
|
||||
{investigating ? "智能体正在核对季集" : "需要你确认"}
|
||||
</StatusBadge>
|
||||
{investigating ? <LoaderCircle className="h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
|
||||
{d.agentRunId ? (
|
||||
<Button asChild variant="ghost" size="sm">
|
||||
<Link to={consolePath("agent", d.agentRunId)}>查看排查过程</Link>
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
{suggestion ? (
|
||||
<p className="break-words text-caption text-muted-foreground">{humanizeReason(suggestion)}</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 集数待确认事项的证据与操作。onEdit 给了(作品页集数映射里)时「修改」把这一行放进编辑器草稿,否则跳到作品页。
|
||||
*/
|
||||
@@ -260,8 +289,9 @@ export function EpisodeDecision({ d, open, onEdit }: { d: Decision; open: boolea
|
||||
const modifyHref = view.entityId ? mappingHref(consolePath("library", view.entityId), editLine ?? undefined) : null;
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<EpisodeDecisionStatus d={d} />
|
||||
<EpisodeDecisionBody view={view} simulation={sug ? simulationText(preview.data) : null} />
|
||||
{open ? (
|
||||
{open && d.status !== "investigating" ? (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{view.confirmAgent && view.agentSuggestion ? (
|
||||
<ConfirmDialog
|
||||
|
||||
Reference in new issue
Block a user