素材云下载
This commit is contained in:
@@ -15,6 +15,23 @@ interface AppState {
|
||||
records: api.GenerationRecordPageListOut;
|
||||
loading: boolean;
|
||||
|
||||
// 生成配置状态 - 页面跳转时保留,刷新时重置
|
||||
mediaType: string;
|
||||
countType: string;
|
||||
selectedRatio: string;
|
||||
selectedResolution: string;
|
||||
width: number;
|
||||
height: number;
|
||||
videoDuration: number;
|
||||
videoAspectRatio: string;
|
||||
videoResolution: string;
|
||||
engineOptions: {
|
||||
ratios: string[];
|
||||
resolutions: string[];
|
||||
durations: number[];
|
||||
};
|
||||
enginesele: any;
|
||||
|
||||
fetchProjects: () => Promise<void>;
|
||||
createProject: (name: string, industry: Industry) => Promise<Project>;
|
||||
deleteProject: (id: string) => Promise<void>;
|
||||
@@ -23,6 +40,23 @@ interface AppState {
|
||||
optimizePrompt: (projectId: string, params: OptimizeParams) => Promise<OptimizeResult>;
|
||||
generateVideo: (recordId: string, params: GenerateParams) => Promise<GenerationRecord>;
|
||||
updateRecordReferences: (recordId: string, references: MediaReference[]) => void;
|
||||
|
||||
// 生成配置状态更新方法
|
||||
setMediaType: (mediaType: string) => void;
|
||||
setCountType: (countType: string) => void;
|
||||
setImageSettings: (ratio: string, resolution: string, width: number, height: number) => void;
|
||||
setVideoSettings: (duration: number, aspectRatio: string, resolution: string) => void;
|
||||
setEngineOptions: (options: { ratios: string[]; resolutions: string[]; durations: number[] }) => void;
|
||||
// 单独的 setter 方法
|
||||
setSelectedRatio: (ratio: string) => void;
|
||||
setSelectedResolution: (resolution: string) => void;
|
||||
setWidth: (width: number) => void;
|
||||
setHeight: (height: number) => void;
|
||||
setVideoDuration: (duration: number) => void;
|
||||
setVideoAspectRatio: (aspectRatio: string) => void;
|
||||
setVideoResolution: (resolution: string) => void;
|
||||
setEnginesele: (enginesele: any) => void;
|
||||
resetGenerationConfig: () => void;
|
||||
}
|
||||
|
||||
export const useAppStore = create<AppState>((set, get) => ({
|
||||
@@ -30,6 +64,23 @@ export const useAppStore = create<AppState>((set, get) => ({
|
||||
records: emptyRecordsPage(),
|
||||
loading: false,
|
||||
|
||||
// 生成配置状态初始值
|
||||
mediaType: 'image',
|
||||
countType: '请选择',
|
||||
selectedRatio: '1:1',
|
||||
selectedResolution: '2K',
|
||||
width: 2048,
|
||||
height: 2048,
|
||||
videoDuration: 5,
|
||||
videoAspectRatio: '16:9',
|
||||
videoResolution: '720p',
|
||||
engineOptions: {
|
||||
ratios: ['16:9', '4:3', '1:1', '3:4', '9:16', '21:9'],
|
||||
resolutions: ['480p', '720p', '1080p'],
|
||||
durations: [5, 8, 10, 12, 15],
|
||||
},
|
||||
enginesele: [],
|
||||
|
||||
fetchProjects: async () => {
|
||||
set({ loading: true });
|
||||
try {
|
||||
@@ -99,4 +150,39 @@ export const useAppStore = create<AppState>((set, get) => ({
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 生成配置状态更新方法
|
||||
setMediaType: (mediaType) => set({ mediaType }),
|
||||
setCountType: (countType) => set({ countType }),
|
||||
setImageSettings: (ratio, resolution, width, height) =>
|
||||
set({ selectedRatio: ratio, selectedResolution: resolution, width, height }),
|
||||
setVideoSettings: (duration, aspectRatio, resolution) =>
|
||||
set({ videoDuration: duration, videoAspectRatio: aspectRatio, videoResolution: resolution }),
|
||||
setEngineOptions: (options) => set({ engineOptions: options }),
|
||||
// 单独的 setter 方法
|
||||
setSelectedRatio: (ratio) => set({ selectedRatio: ratio }),
|
||||
setSelectedResolution: (resolution) => set({ selectedResolution: resolution }),
|
||||
setWidth: (width) => set({ width }),
|
||||
setHeight: (height) => set({ height }),
|
||||
setVideoDuration: (duration) => set({ videoDuration: duration }),
|
||||
setVideoAspectRatio: (aspectRatio) => set({ videoAspectRatio: aspectRatio }),
|
||||
setVideoResolution: (resolution) => set({ videoResolution: resolution }),
|
||||
setEnginesele: (enginesele) => set({ enginesele }),
|
||||
resetGenerationConfig: () => set({
|
||||
mediaType: 'image',
|
||||
countType: '请选择',
|
||||
selectedRatio: '1:1',
|
||||
selectedResolution: '2K',
|
||||
width: 2048,
|
||||
height: 2048,
|
||||
videoDuration: 5,
|
||||
videoAspectRatio: '16:9',
|
||||
videoResolution: '720p',
|
||||
engineOptions: {
|
||||
ratios: ['16:9', '4:3', '1:1', '3:4', '9:16', '21:9'],
|
||||
resolutions: ['480p', '720p', '1080p'],
|
||||
durations: [5, 8, 10, 12, 15],
|
||||
},
|
||||
enginesele: [],
|
||||
}),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user