fix: 收口三视图错误提示
This commit is contained in:
@@ -19,7 +19,7 @@ import type {
|
||||
UserPreference
|
||||
} from "./types";
|
||||
import { publicModelDisplayName } from "./model-display";
|
||||
import { isPublicGenerationError, presentGenerationError } from "./generation-error";
|
||||
import { generationErrorText } from "./generation-error";
|
||||
import { CornerMarks, Decorations, Sidebar, ToastLike } from "./components/app-shell";
|
||||
import {
|
||||
AccountPage,
|
||||
@@ -75,11 +75,6 @@ const crumbLabels: Partial<Record<Page, string>> = {
|
||||
const imgwbKey = (mode?: string) => `airshelf:imgwb:${mode || "image"}`;
|
||||
type ImgwbSaved = { pending?: string[]; results?: Asset[]; count?: number; ts?: number; productId?: string; productTitle?: string };
|
||||
|
||||
function generationTaskErrorText(error: unknown, fallback: string): string {
|
||||
if (!isPublicGenerationError(error)) return fallback;
|
||||
const presentation = presentGenerationError(error);
|
||||
return `${presentation.title}:${presentation.description}`;
|
||||
}
|
||||
function loadImgwb(mode?: string): ImgwbSaved | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(imgwbKey(mode));
|
||||
@@ -634,7 +629,7 @@ export function App() {
|
||||
if (!TERMINAL.has(t.status)) continue;
|
||||
pending.delete(t.id);
|
||||
if (t.status === "succeeded") assets.push(...(t.assets || []));
|
||||
else if (t.error_message) lastErr = generationTaskErrorText(t.error, t.error_message);
|
||||
else if (t.error_message) lastErr = generationErrorText(t.error, t.error_message);
|
||||
}
|
||||
// 进度回写:保留还在跑的 id + 已出结果,供刷新后恢复
|
||||
saveImgwb(mode, { pending: [...pending], results: assets });
|
||||
@@ -670,7 +665,7 @@ export function App() {
|
||||
if (!TERMINAL.has(t.status)) continue;
|
||||
pending.delete(t.id);
|
||||
if (t.status === "succeeded") assets.push(...(t.assets || []));
|
||||
else if (t.error_message) error = generationTaskErrorText(t.error, t.error_message);
|
||||
else if (t.error_message) error = generationErrorText(t.error, t.error_message);
|
||||
}
|
||||
}
|
||||
return { assets, error };
|
||||
|
||||
Reference in New Issue
Block a user