45 lines
932 B
TypeScript
45 lines
932 B
TypeScript
|
|
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
|
|
export interface StorybookPage {
|
|
page_number: number
|
|
text: string
|
|
image_prompt: string
|
|
image_url?: string
|
|
}
|
|
|
|
export interface Storybook {
|
|
id?: number // 新增
|
|
title: string
|
|
main_character: string
|
|
art_style: string
|
|
pages: StorybookPage[]
|
|
cover_prompt: string
|
|
cover_url?: string
|
|
generation_status?: string
|
|
text_status?: string
|
|
image_status?: string
|
|
audio_status?: string
|
|
last_error?: string | null
|
|
retryable_assets?: Array<'image' | 'audio'>
|
|
}
|
|
|
|
export const useStorybookStore = defineStore('storybook', () => {
|
|
const currentStorybook = ref<Storybook | null>(null)
|
|
|
|
function setStorybook(storybook: Storybook) {
|
|
currentStorybook.value = storybook
|
|
}
|
|
|
|
function clearStorybook() {
|
|
currentStorybook.value = null
|
|
}
|
|
|
|
return {
|
|
currentStorybook,
|
|
setStorybook,
|
|
clearStorybook,
|
|
}
|
|
})
|