mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-07-24 06:54:06 +08:00
fix: resolve issue with image retry results not persisting after page refresh in the image workbench
This commit is contained in:
+1
-2
@@ -3,8 +3,7 @@
|
||||
## Unreleased
|
||||
|
||||
+ [新增] 新增Codex App插件支持。
|
||||
+ [修复] 修复前端 TypeScript 构建报错。
|
||||
+ [调整] Docker 运行镜像改为 nginx 静态托管。
|
||||
+ [修复] 修复生图工作台重试成功结果刷新后丢失的问题。
|
||||
|
||||
## v0.5.0 - 2026-07-05
|
||||
|
||||
|
||||
@@ -17,3 +17,4 @@ description: 当前版本已实现但仍需人工验证的变更项
|
||||
- Vercel 部署:新增 `web` 和 `docs` 两个子项目的 Vercel 配置,需分别验证静态前端和文档站部署。
|
||||
- Docker 部署:运行镜像从 Node serve 改为 nginx 静态托管,需验证前端路由刷新回退。
|
||||
- 环境变量:移除过期的后端 `.env.example` 示例文件。
|
||||
- 生图工作台:修复失败图片点击重试后只保存在页面状态、刷新或跳转后丢失的问题,重试成功结果会写入本地图片存储和生成记录。
|
||||
|
||||
@@ -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