chore: update ji branch work

This commit is contained in:
吉鑫升 committed 2026-06-04 17:46:11 +08:00
1 parent 6c30e649e3
commit cbd07c9d1b
9 files changed
+188 -124

No files matched your search

@@ -270,7 +270,16 @@ export default function ScheduledTaskRunDetailPage() {
}
};
const resultFiles = useMemo(() => result?.files ?? [], [result]);
// The generated HTML document is already shown in the dedicated "HTML 预览"
// tab, so it is excluded from the "结果文件" list — that list surfaces the
// Markdown (and any other non-HTML artifact) only.
const resultFiles = useMemo(
() =>
(result?.files ?? []).filter(
(f) => !(f.kind === "html" || (f.name ?? "").toLowerCase().endsWith(".html")),
),
[result],
);
const fileCount = resultFiles.length;
const resultMetadata = useMemo(() => {
if (!result) return "";
@@ -295,18 +304,28 @@ export default function ScheduledTaskRunDetailPage() {
}
setFilesLoading(true);
try {
const loaded = await Promise.all(
// Load each file independently. A single failing file (e.g. an archive
// that 404s) must NOT blank the whole panel — otherwise the tab shows
// "结果文件(2)" while the body says "没有生成文件". Render every file
// that loads and skip the ones that don't.
const settled = await Promise.allSettled(
resultFiles.map((f) => {
const index = result.files.indexOf(f);
return getScheduledTaskRunFileContent(run.id, index);
}),
);
if (!cancelled) {
const loaded = settled
.filter(
(r): r is PromiseFulfilledResult<ScheduledTaskResultFileContent> =>
r.status === "fulfilled",
)
.map((r) => r.value);
setFileContents(loaded);
}
} catch (error) {
if (!cancelled) {
toast.error(error instanceof Error ? error.message : "加载文件内容失败");
const failed = settled.length - loaded.length;
if (failed > 0 && loaded.length === 0) {
toast.error("结果文件已不可用(可能已被清理)");
}
}
} finally {
if (!cancelled) {
@@ -584,7 +603,9 @@ export default function ScheduledTaskRunDetailPage() {
)}
{!filesLoading && fileContents.length === 0 && (
<div className="text-muted-foreground rounded-md border p-3 text-sm">
本次执行没有生成文件。
{fileCount > 0
? `本次执行生成了 ${fileCount} 个文件,但当前无法读取(文件可能已被清理或移动)。可尝试「下载全部」。`
: "本次执行没有生成文件。"}
</div>
)}
<div className="flex flex-col gap-3">