You've already forked Nano-Banana-AI-Image-Editor
修复 首次生成结果不显示的问题;
This commit is contained in:
@@ -53,19 +53,6 @@ export const useImageGeneration = () => {
|
||||
|
||||
addGeneration(generation);
|
||||
setCanvasImage(outputAssets[0].url);
|
||||
|
||||
// 如果没有项目则创建项目
|
||||
if (!currentProject) {
|
||||
const newProject = {
|
||||
id: generateId(),
|
||||
title: '未命名项目',
|
||||
generations: [generation],
|
||||
edits: [],
|
||||
createdAt: Date.now(),
|
||||
updatedAt: Date.now()
|
||||
};
|
||||
setCurrentProject(newProject);
|
||||
}
|
||||
}
|
||||
setIsGenerating(false);
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { create } from 'zustand';
|
||||
import { devtools } from 'zustand/middleware';
|
||||
import { Project, Generation, Edit, SegmentationMask, BrushStroke } from '../types';
|
||||
import { generateId } from '../utils/imageUtils';
|
||||
|
||||
interface AppState {
|
||||
// 当前项目
|
||||
@@ -140,7 +141,15 @@ export const useAppStore = create<AppState>()(
|
||||
...state.currentProject,
|
||||
generations: [...state.currentProject.generations, generation],
|
||||
updatedAt: Date.now()
|
||||
} : null
|
||||
} : {
|
||||
// 如果没有项目,创建一个新项目包含此生成记录
|
||||
id: generateId(),
|
||||
title: '未命名项目',
|
||||
generations: [generation],
|
||||
edits: [],
|
||||
createdAt: Date.now(),
|
||||
updatedAt: Date.now()
|
||||
}
|
||||
})),
|
||||
|
||||
addEdit: (edit) => set((state) => ({
|
||||
|
||||
Reference in New Issue
Block a user