fix: replace raw codes and internal IDs in the console with Chinese labels

Found in v0.2 visual QA (docs/plan/09-visual-qa.md):
- actor strings (admin_session:<uuid>, user:<uuid>, system) -> 管理员/系统/API Key
  in policy revisions, subscriptions, inbox, trash, business tasks, organize detail
- cache volume without key shows the downloader name instead of instance:<uuid>
- download timeline/plan: task and organize statuses, plan purpose, priority and
  status reason localized; audit gets labels for capability/files/site/feed actions
- organize record reason uses conflict detail (没有可入库的主视频) instead of
  blocked:no_main_video; slot/candidate reasons drop inflight:<uuid>
- identity decision summary no longer shows no_viable_candidate
- upstream test: 'Connection error.' classified as network, with a Chinese hint
- new policy draft prefills key default (placeholder looked like a value)
- dialog/sheet close sr-only text in Chinese

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 15:22:15 +08:00
1 parent d7eb6a45d0
commit 46d37d87fe
23 files changed
+176 -43

No files matched your search

+32
View File
@@ -124,3 +124,35 @@ export function spanSec(r: { startedAt: string | null; finishedAt: string | null
const end = r.finishedAt ? new Date(r.finishedAt).getTime() : Date.now();
return (end - new Date(r.startedAt).getTime()) / 1000;
}
/** 服务端记录的操作者串(`admin_session:<id>` / `api_key:<id>` / `policy:<key>` / `system`)→ 界面文字,不露内部 ID */
export function actorText(v: string | null | undefined): string {
if (!v) return "—";
const i = v.indexOf(":");
const kind = i < 0 ? v : v.slice(0, i);
const rest = i < 0 ? "" : v.slice(i + 1);
if (kind === "admin_session" || kind === "dev_admin" || kind === "user") return "管理员";
if (kind === "agent" || kind === "agent_run") return "Agent";
if (kind === "schedule" || kind === "scheduler") return "定时任务";
if (kind === "api_key") return "API Key";
if (kind === "policy") return `收录策略 ${rest}`;
if (v === "system") return "系统";
return v;
}
export const ACTOR_TYPES = [
{ value: "user", label: "管理员" },
{ value: "api_key", label: "API Key" },
{ value: "agent", label: "Agent" },
{ value: "system", label: "系统" },
];
export const actorTypeLabel = (t: string) => ACTOR_TYPES.find((a) => a.value === t)?.label ?? t;
/** 下载计划 statusReason(`added`、`organize:succeeded` 等)→ 中文;不认识的原样显示 */
const PLAN_REASON: Record<string, string> = {
added: "已添加到下载器",
"organize:succeeded": "整理成功",
"organize:partial": "部分整理成功",
"organize:failed": "整理失败",
};
export const planReasonText = (v: string | null | undefined) => (v ? (PLAN_REASON[v] ?? v) : null);