import { BookTaskDetailModel } from '@/define/db/model/bookTaskDetail' import { BookBackTaskStatus, BookBackTaskType, BookTaskStatus, BookType, TaskExecuteType, BookRepalceDataType } from '../../enum/bookEnum' import { MJAction } from '../../enum/bookEnum' import { BookTaskDetail } from './bookTaskDetail' import { ImageCategory } from '@/define/data/imageData' import { ImageGenerateMode } from '@/define/data/mjData' declare namespace Book { //#region 小说相关 /** * 小说数据类型 */ type SelectBook = { id?: string no?: number name?: string bookFolderPath?: string type?: BookType oldVideoPath?: string srtPath?: string audioPath?: string draftDepend?: string // 草稿依赖 imageFolder?: string draftSrtStyle?: string | null // 草稿字幕样式 backgroundMusic?: string | null // 背景音乐ID friendlyReminder?: string | null // 友情提示 subtitlePosition?: string watermarkPosition?: string updateTime?: Date createTime?: Date version?: string imageStyle?: string[] | null // 软件内置的样式 autoAnalyzeCharacter?: string | null // 自动分析角色设置 customizeImageStyle?: string[] | null // 自定义的样式 videoConfig?: string | null // 合成视频设置 prefixPrompt?: string | null // 前缀 suffixPrompt?: string | null // 后缀 } /** * 查询小说的条件 */ type QueryBookCondition = { id?: string name?: string page?: number pageSize?: number type?: BookType } /** * 查询小说的返回类型 */ type QueryBookConditionResponse = { resultBooks: SelectBook[] bookLength: number } //#endregion //#region 小说任务相关 /** * 小说批次任务类型 */ type SelectBookTask = { no?: number id?: string bookId?: string name?: string generateVideoPath?: string srtPath?: string audioPath?: string draftDepend?: string draftSrtStyle?: string | null // 草稿字幕样式 backgroundMusic?: string | null // 背景音乐ID friendlyReminder?: string | null // 友情提示 imageFolder?: string customizeImageStyle?: string[] cacheImageList?: string[] prefixPrompt?: string suffixPrompt?: string styleList?: BookStyle[] | DefineBookStyle[] // 样式列表, status?: BookTaskStatus errorMsg?: string version?: string imageCategory?: ImageCategory // 出图方式 imageStyle?: string[] | null // 软件内置的样式 autoAnalyzeCharacter?: string | null // 自动分析角色设置 customizeImageStyle?: string[] | null // 自定义的样式 videoConfig?: string | null // 合成视频设置 prefixPrompt?: string | null // 前缀 suffixPrompt?: string | null // 后缀 isAuto?: boolean // 是否标记全自动 subImageFolder?: string[] | null // 子图片文件夹地址,多个 openVideoGenerate?: boolean // 是否开启视频生成 createTime?: Date updateTime?: Date } /** * 查询小说批次任务的条件 */ type QueryBookTaskCondition = { id?: string no?: number name?: string bookId?: string bookTaskId?: string page?: number pageSize?: number } /** * 查询小说人物的返回数据类型 */ type QueryBookTaskConditionResponse = { bookTasks: SelectBookTask[] bookTaskLength: number } //#endregion //#region 小说任务详细数据相关 type SelectBookTaskDetail = { id?: string no?: number name?: string bookId?: string bookTaskId?: string videoPath?: string // 视频地址 generateVideoPath?: string // 生成的视频地址 audioPath?: string // 音频地址 draftDepend?: string // 草稿依赖 word?: string // 文案 oldImage?: string // 旧图片(用于SD的图生图) afterGpt?: string // GPT生成的文案 startTime?: number // 开始时间 endTime?: number // 结束时间 timeLimit?: string // 事件实现(0 -- 3000) subValue?: BookTaskDetail.CopywritingSubValue[] | string // 包含的字幕数据 characterTags?: string[] // 角色标签 sceneTags?: string[] // 场景标签 styleTags?: string[] // 风格标签 promptSort?: string // 提示词排序 gptPrompt?: string // GPT提示词 mjMessage?: MJMessage // MJ消息 videoMessage?: BookTaskDetail.VideoMessage // 视频消息 outImagePath?: string // 输出图片地址 subImagePath?: string[] // 子图片地址 imageLock?: boolean // 图片锁 reversePrompt?: ReversePrompt[] // 反推的提示词数据 prompt?: string // 提示 adetailer?: boolean // 是否开启修脸 sdConifg?: SDConfig // SD配置 subtitlePosition?: string // 字幕位置 status?: BookTaskStatus createTime?: Date updateTime?: Date } type QueryBookTaskDetailCondition = { id?: string name?: string bookId?: string bookTaskId?: string page?: number pageSize?: number } //#endregion // 添加批次任务 type AddBookTask = { copyBookTask: boolean // 是否复制旧的小说任务 count: number // 批次数量 prefixPrompt?: string // 前缀提示 suffixPrompt?: string // 后缀提示词 selectBookTask?: string // 选择的旧的小说任务 selectTaskDataCategory?: string[] // 选择复制的数据类型 selectBookId: string // 选择的小说ID } // 返回的MJ消息 type MJMessage = { id?: string mjApiUrl?: string progress: number category: ImageGenerateMode imageClick?: string // 图片点击(显示的小的) imageShow?: string // 图片实际的地址 messageId?: string // 消息ID(可以是MJ中的,也可以是API中的) action?: MJAction // 动作(生图,反推之类) status: string // 状态 message?: string // 消息 } type WebuiConfig = { sampler_name: string // 采样器名称 negative_prompt: string // 负面提示 batch_size: number // 批次大小 steps: number // 步数 cfg_scale: number // 提示词相关性 denoising_strength: number // 降噪强度 width: number // 宽度 height: number // 高度 seed: number // 种子 init_images: string // 初始图片(垫图的图片地址) id: string } type SDConfig = { checkpoints: string // 大模型 api: string // api地址 model: string // 生图方式 webuiConfig: WebuiConfig id: string } type ReversePrompt = { id?: string bookTaskDetailId?: string prompt?: string promptCN?: string isSelect?: boolean } // 查询小说任务的 type QueryBookBackTaskCondition = { id: string bookId: string bookTaskId: string name: string type: string status: string executeType: string count: number } // 更新小说任务状态 type UpdateBookTaskListStatus = { id: string status: BookBackTaskStatus errorMessage?: string startTime?: number endTime?: number } // 小说人物 type BookTask = { id: string bookId: string bookTaskId: string bookTaskDetailId: string name: string // 任务名称,小说名+批次名+分镜名 type: BookBackTaskType status: BookBackTaskStatus errorMessage?: string executeType: TaskExecuteType // 任务执行类型,手动还是自动 createTime: Date updateTime: Date startTime?: number endTime?: number } // 获取小说文案的参数 type GetVideoFrameTextParams = { id: string type: SubtitleSavePositionType videoPath: string subtitlePosition?: string } // 小说风格 type BookStyle = { id?: string label?: string key?: string value?: string children?: string type?: string prompt?: string image_url?: string cref_cw?: number lora?: string chinese_prompt?: string lora_weight?: number show_image?: string isShow?: boolean } type DefineBookStyle = { chinese_style?: string english_style?: string id?: string image?: string } /** * 裁剪小视频的返回数据类型 */ type BookFrameShortClip = { startTime: number endTime: number videoPath: string duration: number } type DeleteBookTaskDetailCondition = { id?: string bookId?: string bookTaskId?: string name?: string } //#region 替换小说数据 type BookReplaceData = { before: string after: string replaceAll?: boolean type: BookRepalceDataType } type ReplaceDataRes = { bookTaskDetailId: string newData: string | BookTaskDetail.CopywritingSubValue[] type?: 'reversePrompt' | 'gptPrompt' | 'afterGpt' | 'prompt' | 'subValue' reversePromptType?: 'prompt' | 'promptCN' reversePromptId?: string } //#endregion }