mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-07-31 13:41:18 +08:00
fix: resolve issue with image retry results not persisting after page refresh in the image workbench
This commit is contained in:
@@ -296,12 +296,34 @@ export default function ImagePage() {
|
||||
}
|
||||
};
|
||||
|
||||
const retryResult = (index: number) => {
|
||||
const retryResult = async (index: number) => {
|
||||
const snapshot = buildRequestSnapshot();
|
||||
if (!snapshot) return;
|
||||
setPreviewLog(null);
|
||||
setResults((value) => updateResultAt(value, index, { status: "pending", error: undefined, image: undefined }));
|
||||
void runGenerationSlot(index, snapshot).catch(() => {});
|
||||
const retryStartedAt = performance.now();
|
||||
try {
|
||||
const image = await runGenerationSlot(index, snapshot);
|
||||
const stored = await uploadImage(image.dataUrl);
|
||||
const logImage = { ...image, dataUrl: stored.url, storageKey: stored.storageKey, width: stored.width, height: stored.height, bytes: stored.bytes, mimeType: stored.mimeType };
|
||||
setResults((value) => updateResultAt(value, index, { image: { ...image, dataUrl: stored.url, storageKey: stored.storageKey } }));
|
||||
saveLog(
|
||||
buildLog({
|
||||
prompt: snapshot.text,
|
||||
model,
|
||||
config: { ...snapshot.config, count: "1" },
|
||||
references: snapshot.references,
|
||||
durationMs: performance.now() - retryStartedAt,
|
||||
successCount: 1,
|
||||
failCount: 0,
|
||||
status: "成功",
|
||||
images: [logImage],
|
||||
}),
|
||||
);
|
||||
message.success("重试成功");
|
||||
} catch {
|
||||
// runGenerationSlot 已经把结果状态更新为 failed
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user