- 新增 TechInfo 折叠组件(默认收起,标题「技术信息」);设置新增「界面」分区, 「默认展开技术信息」开关存本机浏览器 - 原因码表 @umt/contracts reasons.ts(identity_unknown、blocked:target_exists、below_min_size… → 一句人话 + 下一步),服务端整理记录 message 与冲突事项标题/摘要改用它 - 整理记录列表/详情、下载详情与时间线:原码、ID、hash、用时、变更序号进技术信息; 下载完成但入库失败时单独提示;时间线只列有记录的阶段,标题改「经过」 - 待处理:没识别出作品类事项主按钮「指定作品」(搜媒体库 + TMDB,走已有 resolve; 整理类事项打开重新整理),忽略为次要;去掉正常态徽章与「实时」指示;原始证据改「详细信息」进技术信息 - 整理成功后同时关闭该下载的「没识别出作品」事项 Co-Authored-By: Claude Opus 5.5 <[email protected]>
54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import { ChevronDown } from "lucide-react";
|
|
import { type ReactNode, useId, useState } from "react";
|
|
import { CHEVRON_CLASS, Disclosure } from "~/components/agentui/disclosure.tsx";
|
|
import { type KvItem, KvList } from "~/components/console/kv-list.tsx";
|
|
import { useUiPrefs } from "~/lib/ui-prefs.ts";
|
|
import { cn } from "~/lib/utils.ts";
|
|
|
|
/**
|
|
* 技术信息折叠区:ID、hash、trace、token 数、耗时、模型 ID、原始字段、内部状态码都放这里,默认收起
|
|
* (设置 → 界面可改为默认展开)。值为空的项不显示;全部为空时整块不渲染。
|
|
*/
|
|
export function TechInfo({
|
|
items,
|
|
children,
|
|
title = "技术信息",
|
|
className,
|
|
columns = 2,
|
|
}: {
|
|
items?: (KvItem | null | false | undefined)[];
|
|
children?: ReactNode;
|
|
title?: string;
|
|
className?: string;
|
|
columns?: 1 | 2;
|
|
}) {
|
|
const prefs = useUiPrefs();
|
|
const [override, setOverride] = useState<boolean | null>(null);
|
|
const open = override ?? prefs.techInfoExpanded;
|
|
const id = useId();
|
|
const rows = (items ?? []).filter(
|
|
(it): it is KvItem => !!it && it.value !== null && it.value !== undefined && it.value !== "",
|
|
);
|
|
if (!rows.length && !children) return null;
|
|
return (
|
|
<div className={cn("min-w-0", className)} data-slot="tech-info">
|
|
<button
|
|
type="button"
|
|
aria-expanded={open}
|
|
aria-controls={id}
|
|
onClick={() => setOverride(!open)}
|
|
className="inline-flex items-center gap-1 rounded-md py-1 text-meta text-muted-foreground transition-colors duration-micro hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none"
|
|
>
|
|
{title}
|
|
<ChevronDown className={cn("size-3.5", CHEVRON_CLASS, open && "rotate-180")} aria-hidden />
|
|
</button>
|
|
<Disclosure id={id} open={open}>
|
|
<div className="grid gap-3 pt-2 pb-1">
|
|
{rows.length ? <KvList items={rows.map((r) => ({ mono: true, ...r }))} columns={columns} /> : null}
|
|
{children}
|
|
</div>
|
|
</Disclosure>
|
|
</div>
|
|
);
|
|
}
|