|
@@ -838,7 +838,8 @@ const ProjectDetail = () => {
|
838
|
838
|
* 生成所有分镜图片
|
839
|
839
|
*/
|
840
|
840
|
const generateAllImages = async (isForceRedraw = false) => {
|
841
|
|
- if (generatingImages) {
|
|
841
|
+ // 如果已经在生成中,直接返回
|
|
842
|
+ if (isGenerating) {
|
842
|
843
|
toast.info('正在绘制图片中,请等待当前操作完成');
|
843
|
844
|
return;
|
844
|
845
|
}
|
|
@@ -1275,6 +1276,7 @@ const ProjectDetail = () => {
|
1275
|
1276
|
|
1276
|
1277
|
// 4. 更新UI状态
|
1277
|
1278
|
setIsPaused(false);
|
|
1279
|
+ setGeneratingImages(true); // 确保UI显示为生成中状态
|
1278
|
1280
|
setSegments(prevSegments =>
|
1279
|
1281
|
prevSegments.map(segment =>
|
1280
|
1282
|
pausedSegments.some(paused => paused.id === segment.id)
|
|
@@ -1290,20 +1292,17 @@ const ProjectDetail = () => {
|
1290
|
1292
|
});
|
1291
|
1293
|
|
1292
|
1294
|
// 5. 更新localStorage中的暂停状态
|
1293
|
|
- const storageItem = localStorage.getItem(`project_${projectId}_image_generation`);
|
1294
|
|
- if (storageItem) {
|
1295
|
|
- localStorage.setItem(`project_${projectId}_image_generation`, JSON.stringify({
|
1296
|
|
- progress: { current: completedCount, total: totalCount },
|
1297
|
|
- isPaused: false,
|
1298
|
|
- timestamp: new Date().getTime()
|
1299
|
|
- }));
|
1300
|
|
- }
|
|
1295
|
+ localStorage.setItem(`project_${projectId}_image_generation`, JSON.stringify({
|
|
1296
|
+ progress: { current: completedCount, total: totalCount },
|
|
1297
|
+ isPaused: false,
|
|
1298
|
+ timestamp: new Date().getTime()
|
|
1299
|
+ }));
|
1301
|
1300
|
|
1302
|
1301
|
// 6. 启动绘画流程
|
1303
|
1302
|
toast.info('继续图片生成任务');
|
1304
|
|
- setTimeout(() => {
|
1305
|
|
- generateAllImages(false);
|
1306
|
|
- }, 500);
|
|
1303
|
+
|
|
1304
|
+ // 直接调用generateAllImages,不使用setTimeout
|
|
1305
|
+ await generateAllImages(false);
|
1307
|
1306
|
} catch (error) {
|
1308
|
1307
|
console.error('恢复图片生成失败:', error);
|
1309
|
1308
|
toast.error('恢复失败: ' + error.message);
|