import Realm, { ObjectSchema } from 'realm' import { BookTaskStatus, MJAction } from '@/define/enum/bookEnum' import { MJImageType } from '@/define/enum/mjEnum' export class Subtitle extends Realm.Object { startTime!: number endTime!: number srtValue!: string id!: string static schema = { name: 'Subtitle', properties: { startTime: 'int', endTime: 'int', srtValue: 'string', id: 'string' }, primaryKey: 'id' } } export class MJMessage extends Realm.Object { id!: string mjApiUrl!: string | null progress!: number category!: MJImageType imageClick!: string | null // 图片点击(显示的小的) imageShow!: string | null // 图片实际的地址 messageId!: string // 消息ID(可以是MJ中的,也可以是API中的) action!: MJAction // 动作(生图,反推之类) status!: string // 状态 message!: string | null // 消息 static schema: ObjectSchema = { name: 'MJMessage', properties: { id: 'string', mjApiUrl: 'string?', progress: 'int', category: 'string', imageClick: 'string?', imageShow: 'string?', messageId: 'string', action: 'string', status: 'string', message: 'string?' }, primaryKey: 'id' } } export class VideoMessage extends Realm.Object { id!: string msg!: string | null videoType!: string prompt!: string | null style!: string | null imageUrl!: string | null model!: string | null bookTaskDetailId!: string status!: string | null videoUrl!: string | null taskId!: string | null runwayOptions!: string | null // 生成视频的一些设置 lumaOptions!: string | null // 生成视频的一些设置 klingOptions!: string | null // 生成视频的一些设置 messageData!: string | null static schema: ObjectSchema = { name: 'VideoMessage', properties: { id: 'string', msg: 'string?', videoType: 'string', bookTaskDetailId: 'string?', prompt: 'string?', style: 'string?', imageUrl: 'string?', model: 'string?', status: 'string?', videoUrl: 'string?', taskId: 'string?', runwayOptions: 'string?', lumaOptions: 'string?', klingOptions: 'string?', messageData: 'string?' }, primaryKey: 'id' } } export class WebuiConfig extends Realm.Object { 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 static schema: ObjectSchema = { name: 'WebuiConfig', properties: { sampler_name: 'string', negative_prompt: 'string', batch_size: 'int', steps: 'int', cfg_scale: 'int', denoising_strength: 'int', width: 'int', height: 'int', seed: 'int', init_images: 'string', id: 'string' }, primaryKey: 'id' } } export class SDConfig extends Realm.Object { checkpoints!: string // 大模型 api!: string // api地址 model!: string // 生图方式 webuiConfig!: WebuiConfig id!: string static schema: ObjectSchema = { name: 'SDConfig', properties: { checkpoints: 'string', api: 'string', model: 'string', webuiConfig: 'WebuiConfig', id: 'string' }, primaryKey: 'id' } } // 放反推的提示词的对象 export class ReversePrompt extends Realm.Object { id!: string bookTaskDetailId!: string prompt!: string promptCN!: string isSelect!: boolean static schema: ObjectSchema = { name: 'ReversePrompt', properties: { id: 'string', bookTaskDetailId: 'string', prompt: 'string', promptCN: 'string', isSelect: 'bool' }, primaryKey: 'id' } } export class BookTaskDetailModel extends Realm.Object { id!: string no!: number name!: string bookId!: string bookTaskId!: string videoPath!: string | null // 视频地址 generateVideoPath!: string | null // 生成视频地址 audioPath!: string | null // 音频地址 word!: string | null // 文案 oldImage!: string | null // 旧图片(用于SD的图生图) afterGpt!: string | null // GPT生成的文案 startTime!: number | null // 开始时间 endTime!: number | null // 结束时间 timeLimit!: string | null // 事件实现(0 -- 3000) subValue!: string | null // 包含的字幕数据 characterTags!: string[] | null // 角色标签 sceneTags!: string[] | null // 场景标签 styleTags!: string[] | null // 风格标签 promptSort!: string | null // 提示词排序 gptPrompt!: string | null // GPT提示词 mjMessage!: MJMessage | null // MJ消息 videoMessage!: VideoMessage | null // 视频消息 outImagePath!: string | null // 输出图片地址 subImagePath!: string[] | null // 子图片地址 imageLock!: boolean // 图片锁 prompt!: string | null // 提示 adetailer!: boolean // 是否开启修脸 sdConifg!: SDConfig | null // SD配置 reversePrompt!: ReversePrompt[] | null // 反推的提示词(数组) subtitlePosition!: string | null // 字幕位置 status!: BookTaskStatus createTime!: Date updateTime!: Date static schema: ObjectSchema = { name: 'BookTaskDetail', properties: { id: 'string', no: 'int', name: 'string', bookId: { type: 'string', indexed: true }, bookTaskId: { type: 'string', indexed: true }, videoPath: 'string?', generateVideoPath: 'string?', // 生成视频地址 audioPath: 'string?', word: 'string?', oldImage: 'string?', afterGpt: 'string?', startTime: 'int?', endTime: 'int?', timeLimit: 'string?', subValue: 'string?', reversePrompt: { type: 'list', objectType: 'ReversePrompt' }, characterTags: { type: 'list', objectType: 'string' }, sceneTags: 'string[]', styleTags: 'string[]', promptSort: 'string?', gptPrompt: 'string?', mjMessage: 'MJMessage?', videoMessage: 'VideoMessage?', outImagePath: 'string?', subImagePath: 'string[]', imageLock: 'bool', prompt: 'string?', adetailer: 'bool', sdConifg: 'SDConfig?', subtitlePosition: 'string?', status: 'string', createTime: 'date', updateTime: 'date' }, // 主键为_id primaryKey: 'id' } }