fix: improve generation task reliability
This commit is contained in:
@@ -152,6 +152,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie
|
||||
abortRef.current = false;
|
||||
taskIdRef.current = saved.taskId;
|
||||
void waitForTask(saved.taskId, {
|
||||
kind: "image",
|
||||
onProgress: (e) => {
|
||||
setStatus(`${e.status} / ${e.progress}%`);
|
||||
if (e.status === "completed" && e.resultUrl) {
|
||||
@@ -446,6 +447,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie
|
||||
|
||||
const pollTaskUntilDone = useCallback(async (taskId: string): Promise<string | null> => {
|
||||
return waitForTask(taskId, {
|
||||
kind: "image",
|
||||
abortRef,
|
||||
onProgress: (e) => setGenerationProgress(e.progress || 0),
|
||||
});
|
||||
@@ -559,7 +561,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie
|
||||
referenceUrls: refUrls,
|
||||
});
|
||||
taskIdRef.current = taskId;
|
||||
saveToolTaskState("imagewb", { taskId, status: "running", progress: 0 });
|
||||
saveToolTaskState("imagewb", { taskId, status: "running", progress: 0 });
|
||||
|
||||
const tempUrl = await pollTaskUntilDone(taskId);
|
||||
if (tempUrl) {
|
||||
|
||||
Reference in New Issue
Block a user