feat(控制台): 去掉待处理中心,问题回到发生处
- 侧栏与命令面板没有「待处理」;/console/inbox?kind= 按问题类型跳到整理记录「需要处理」、下载面板、运行状态或订阅 - 整理记录加「需要处理」筛选,行内写原因与推荐动作(指定作品 / 重新整理 / 让智能体识别 / 替换·保留两者·跳过 / 忽略), 详情页同样可处理;处理按钮从原待处理页抽成 components/decisions/decision-actions.tsx 复用 - 铃铛只放等你批准的智能体操作与系统健康;首页「要我处理」与运行状态「需要关注」放汇总计数,运行状态加智能体用量 - 设置 → 智能体:预算卡改为「用量与限制」(只剩单次工具调用与时长,附花费统计),自动调查卡加「整理识别不到作品时叫智能体识别」 - 集数待确认的原因显示在作品页集数映射(可确认建议规则 / 智能体建议)与订阅详情;未识别资源在媒体库「未识别」里直接选候选或指定 - 下载、站点、任务里指向待处理的链接改到对应页面 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
1c1a954703
commit
fa76d7563c
36 files changed
+1209
-921
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { IdentityPoolItem, PoolCandidate } from "@umt/contracts";
|
||||
import { ArrowRight, BellOff, ExternalLink, LoaderCircle, RotateCw } from "lucide-react";
|
||||
import { BellOff, ExternalLink, LoaderCircle, RotateCw } from "lucide-react";
|
||||
import { useId, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { toast } from "sonner";
|
||||
@@ -19,25 +19,8 @@ import { EnrichSection } from "./identity-enrich.tsx";
|
||||
import { EVIDENCE_LEVEL, POOL_REASON, POOL_STATUS } from "./labels.ts";
|
||||
import { Chip, Tone } from "./parts.tsx";
|
||||
|
||||
// 待识别资源详情:候选证据 + 重新识别 + 手动指定。进了待处理的(与订阅相关的歧义 / 无结果)在待处理里选候选;
|
||||
// 没进待处理的(unmatched:未命中订阅,惰性识别没查 TMDB)在这里手动指定 TMDB ID / 本地作品,或忽略。
|
||||
|
||||
/** 与订阅 / 本地作品相关的歧义开"待确认身份"事项,相关却无结果开"待识别"事项(同来源同标题合并);unmatched 不进待处理 */
|
||||
export function inInbox(item: Pick<IdentityPoolItem, "status" | "reason" | "candidates" | "decisionId">): boolean {
|
||||
return item.status === "pending" && (item.decisionId !== null || hasCandidates(item));
|
||||
}
|
||||
|
||||
function hasCandidates(item: Pick<IdentityPoolItem, "reason" | "candidates">): boolean {
|
||||
return (item.reason === "ambiguous" || item.reason === "proposed") && item.candidates.length > 0;
|
||||
}
|
||||
|
||||
export const INBOX_IDENTITY = `${consolePath("inbox")}?kind=identity_ambiguous`;
|
||||
export const INBOX_UNRESOLVED = `${consolePath("inbox")}?kind=identity_unresolved`;
|
||||
|
||||
/** 条目对应的待处理筛选链接 */
|
||||
export function inboxLink(item: Pick<IdentityPoolItem, "reason" | "candidates">): string {
|
||||
return hasCandidates(item) ? INBOX_IDENTITY : INBOX_UNRESOLVED;
|
||||
}
|
||||
// 未识别资源详情:候选证据 + 重新识别 + 选候选 / 手动指定 / 忽略。
|
||||
// 2026-10-06 起待处理中心取消:搜索 / RSS 扫进来的未识别资源静默留在这里,不再提示;要处理的直接在这里选。
|
||||
|
||||
/** query 摘要:标题 / 年份 / 季集 */
|
||||
export function querySummary(q: Record<string, unknown>): string {
|
||||
@@ -51,7 +34,7 @@ export function querySummary(q: Record<string, unknown>): string {
|
||||
return parts.join(" · ") || "—";
|
||||
}
|
||||
|
||||
function CandidateRow({ c, index }: { c: PoolCandidate; index: number }) {
|
||||
function CandidateRow({ c, index, onPick }: { c: PoolCandidate; index: number; onPick?: () => void }) {
|
||||
return (
|
||||
<li className="min-w-0 rounded-lg border border-border/80 p-3">
|
||||
<div className="flex flex-wrap items-start justify-between gap-2">
|
||||
@@ -67,6 +50,11 @@ function CandidateRow({ c, index }: { c: PoolCandidate; index: number }) {
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap items-center gap-1.5">
|
||||
<Chip>{EVIDENCE_LEVEL[c.level] ?? c.level}</Chip>
|
||||
{onPick ? (
|
||||
<Button variant="outline" size="xs" className="order-last ml-auto" onClick={onPick}>
|
||||
选这个
|
||||
</Button>
|
||||
) : null}
|
||||
{c.localEntityId ? (
|
||||
<Link
|
||||
to={consolePath("library", c.localEntityId)}
|
||||
@@ -185,8 +173,16 @@ function ManualAssign({ item }: { item: IdentityPoolItem }) {
|
||||
|
||||
export function PoolSheet({ item, onClose }: { item: IdentityPoolItem | null; onClose: () => void }) {
|
||||
const retry = useRetryPool();
|
||||
const assign = useAssignPool();
|
||||
if (!item) return null;
|
||||
const queued = inInbox(item);
|
||||
const pick = async (index: number) => {
|
||||
try {
|
||||
await assign.mutateAsync({ id: item.id, candidateIndex: index, lock: true });
|
||||
toast.success("已指定");
|
||||
} catch (err) {
|
||||
toast.error(errorMessage(err, "指定失败"));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<DetailSheet
|
||||
@@ -196,38 +192,23 @@ export function PoolSheet({ item, onClose }: { item: IdentityPoolItem | null; on
|
||||
title={item.release.title}
|
||||
description={item.release.subtitle ?? undefined}
|
||||
footer={
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={retry.isPending}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await retry.mutateAsync(item.id);
|
||||
toast.success("已重新识别");
|
||||
} catch (err) {
|
||||
toast.error(errorMessage(err));
|
||||
}
|
||||
}}
|
||||
>
|
||||
{retry.isPending ? <LoaderCircle className="animate-spin" /> : <RotateCw />}
|
||||
重新识别
|
||||
</Button>
|
||||
{queued ? (
|
||||
<Button asChild>
|
||||
<Link to={inboxLink(item)}>
|
||||
去待处理
|
||||
<ArrowRight />
|
||||
</Link>
|
||||
</Button>
|
||||
) : null}
|
||||
</>
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={retry.isPending}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await retry.mutateAsync(item.id);
|
||||
toast.success("已重新识别");
|
||||
} catch (err) {
|
||||
toast.error(errorMessage(err));
|
||||
}
|
||||
}}
|
||||
>
|
||||
{retry.isPending ? <LoaderCircle className="animate-spin" /> : <RotateCw />}
|
||||
重新识别
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{queued ? (
|
||||
<p className="rounded-lg border border-warning/40 bg-warning/10 px-3 py-2 text-caption text-warning">
|
||||
已进待处理,在那里选择候选或忽略。
|
||||
</p>
|
||||
) : null}
|
||||
<KvList
|
||||
items={[
|
||||
{ label: "状态", value: <Tone v={POOL_STATUS[item.status]} /> },
|
||||
@@ -242,7 +223,7 @@ export function PoolSheet({ item, onClose }: { item: IdentityPoolItem | null; on
|
||||
]}
|
||||
/>
|
||||
|
||||
{item.status !== "resolved" && !queued ? <ManualAssign item={item} /> : null}
|
||||
{item.status !== "resolved" ? <ManualAssign item={item} /> : null}
|
||||
|
||||
{item.status === "pending" && item.reason !== "ambiguous" && item.reason !== "proposed" ? (
|
||||
<EnrichSection key={item.id} item={item} />
|
||||
@@ -252,7 +233,12 @@ export function PoolSheet({ item, onClose }: { item: IdentityPoolItem | null; on
|
||||
{item.candidates.length ? (
|
||||
<ul className="space-y-2">
|
||||
{item.candidates.map((c, i) => (
|
||||
<CandidateRow key={`${c.provider}:${c.entityType}:${c.externalId}`} c={c} index={i} />
|
||||
<CandidateRow
|
||||
key={`${c.provider}:${c.entityType}:${c.externalId}`}
|
||||
c={c}
|
||||
index={i}
|
||||
onPick={item.status === "pending" && !assign.isPending ? () => void pick(i) : undefined}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
|
||||
@@ -5,14 +5,13 @@ import type {
|
||||
IdentityPoolItem,
|
||||
IdentityStatus,
|
||||
} from "@umt/contracts";
|
||||
import { ArrowRight, Fingerprint, Lock, SearchX } from "lucide-react";
|
||||
import { Fingerprint, Lock, SearchX } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useExternalIdentities, useIdentityPool } from "~/api/identity.ts";
|
||||
import { type DataColumn, DataTable } from "~/components/console/data-table.tsx";
|
||||
import { FilterBar, FilterSelect } from "~/components/console/filter-bar.tsx";
|
||||
import { ExternalIdentitySheet, identityRef } from "~/components/library/identity-external-sheet.tsx";
|
||||
import { inboxLink, inInbox, PoolSheet, querySummary } from "~/components/library/identity-pool-sheet.tsx";
|
||||
import { PoolSheet, querySummary } from "~/components/library/identity-pool-sheet.tsx";
|
||||
import {
|
||||
EVIDENCE_LEVEL,
|
||||
IDENTITY_STATUS,
|
||||
@@ -24,7 +23,7 @@ import {
|
||||
import { relTime, Tone } from "~/components/library/parts.tsx";
|
||||
|
||||
// 媒体概览的身份视图(原"身份与元数据"页,IA-3 并入 /console/library):待识别资源、外部身份。
|
||||
// 待识别资源只读;选候选、忽略在待处理里做(docs/design/console-ia.md §3.1 判定只在待处理)。
|
||||
// 未识别资源:点开详情选候选、手动指定或忽略(2026-10-06 起待处理中心取消,不再转去待处理)。
|
||||
|
||||
function useDebounced(v: string, ms = 250) {
|
||||
const [d, setD] = useState(v);
|
||||
@@ -69,16 +68,6 @@ export function PoolTab() {
|
||||
cell: (r) => (
|
||||
<div className="flex flex-col items-start gap-1">
|
||||
<Tone v={POOL_REASON[r.reason]} />
|
||||
{inInbox(r) ? (
|
||||
<Link
|
||||
to={inboxLink(r)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="inline-flex items-center gap-0.5 text-meta whitespace-nowrap text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"
|
||||
>
|
||||
已进待处理
|
||||
<ArrowRight className="h-3 w-3" />
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user