Files
aigc-home/calliope-web/src/lib/missingOutputs.svelte.ts
T
总工andmultica-agent 949cd2ecad HEL-654: D 批——记录流状态语义、金框结果切换、撤销删除与任务页重皮
- 点选金框滑动 + 检视区 150ms 交叉淡变;↑↓/J/K 即时切换、空格播放、
  Delete 删除、] 检视区、浮层让位;新记录入场/完成金光/失败抖动,减动效只余短淡变
- 单条删除 5 秒撤销(Toast 金色动作钮),窗口过后才提交 DELETE,离页 flush;
  任务页同队列同步;工作流删除保留旧记录并标识「工作流已删除」
- 红/琥珀界线:失败红 + 中文结论展开;done 但文件取不到 → 琥珀「文件缺失」
  + 用相同参数重做/移除记录
- 参数页提交自动切结果页;工作流选择器 ↑↓ 真高亮 + Enter 使用(ShellPop arrowRoving 开关)
- 记录流 80 条分页(220 条专项:50 次轮询 490ms);任务页 §3.5 芯片+搜索+
  行内进度条+ghost 重试;i18n 七语种 +17 键

Co-authored-by: multica-agent <github@multica.ai>
2026-09-30 13:02:51 +08:00

39 lines
1.4 KiB
TypeScript

import { SvelteSet } from 'svelte/reactivity';
import type { Job } from '$lib/comfy/types';
/**
* Output files a done job claims but the asset endpoint could not serve
* (spec-v2 §3.4 红/琥珀界线): the backend task status stays the single
* verdict for red — a FAILED job is red no matter what. Amber means the
* job SUCCEEDED and only its product file is gone (cleaned up, moved,
* storage hiccup). We learn that the only way the frontend can: the
* media element itself failed to load. A later successful load clears
* the mark.
*/
const missing = new SvelteSet<string>();
/** Mark one output path as unreachable (img/video onerror). */
export function markOutputMissing(path: string): void {
if (path) missing.add(path);
}
/** Clear the mark when the same path loads fine after all. */
export function clearOutputMissing(path: string): void {
missing.delete(path);
}
/** Paths of this job's outputs that are currently unreachable. */
export function missingOutputsOf(job: Job | null | undefined): string[] {
if (!job || job.status !== 'done' || !(job.output_paths?.length ?? 0))
return [];
return job.output_paths.filter((p) => missing.has(p));
}
/**
* The take reads as 文件缺失 when it succeeded but at least one claimed
* product file cannot be fetched.
*/
export function isFileMissing(job: Job | null | undefined): boolean {
return missingOutputsOf(job).length > 0;
}