File size: 2,094 Bytes
6da9beb 58132fb 6da9beb 58132fb 6da9beb 58132fb 6da9beb c78f7b4 6da9beb 58132fb 6da9beb 58132fb 6da9beb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
"use client"
import { GlobalStatus, TaskStatus } from "@/types"
import { ClapProject } from "@aitube/clap"
import { create } from "zustand"
export const useStore = create<{
storyPromptDraft: string
storyPrompt: string
status: GlobalStatus
storyGenerationStatus: TaskStatus
voiceGenerationStatus: TaskStatus
imageGenerationStatus: TaskStatus
videoGenerationStatus: TaskStatus
generatedClap?: ClapProject
generatedVideo: string
setStoryPromptDraft: (storyPromptDraft: string) => void
setStoryPrompt: (storyPrompt: string) => void
setStatus: (status: GlobalStatus) => void
setStoryGenerationStatus: (storyGenerationStatus: TaskStatus) => void
setVoiceGenerationStatus: (voiceGenerationStatus: TaskStatus) => void
setImageGenerationStatus: (imageGenerationStatus: TaskStatus) => void
setVideoGenerationStatus: (videoGenerationStatus: TaskStatus) => void
setGeneratedClap: (generatedClap?: ClapProject) => void
setGeneratedVideo: (generatedVideo: string) => void
}>((set, get) => ({
storyPromptDraft: "Yesterday I was at my favorite pizza place and..",
storyPrompt: "",
status: "idle",
storyGenerationStatus: "idle",
voiceGenerationStatus: "idle",
imageGenerationStatus: "idle",
videoGenerationStatus: "idle",
generatedClap: undefined,
generatedVideo: "",
setStoryPromptDraft: (storyPromptDraft: string) => { set({ storyPromptDraft }) },
setStoryPrompt: (storyPrompt: string) => { set({ storyPrompt }) },
setStatus: (status: GlobalStatus) => { set({ status }) },
setStoryGenerationStatus: (storyGenerationStatus: TaskStatus) => { set({ storyGenerationStatus }) },
setVoiceGenerationStatus: (voiceGenerationStatus: TaskStatus) => { set({ voiceGenerationStatus }) },
setImageGenerationStatus: (imageGenerationStatus: TaskStatus) => { set({ imageGenerationStatus }) },
setVideoGenerationStatus: (videoGenerationStatus: TaskStatus) => { set({ videoGenerationStatus }) },
setGeneratedClap: (generatedClap?: ClapProject) => { set({ generatedClap }) },
setGeneratedVideo: (generatedVideo: string) => { set({ generatedVideo }) },
})) |