194 lines
5.1 KiB
TypeScript
194 lines
5.1 KiB
TypeScript
import Realm, { ObjectSchema } from 'realm'
|
||
import {
|
||
BookBackTaskStatus,
|
||
BookBackTaskType,
|
||
BookTaskStatus,
|
||
BookType,
|
||
MJAction,
|
||
} from '../../../enum/bookEnum'
|
||
import { MJImageType } from '../../../enum/mjEnum'
|
||
|
||
export class Subtitle extends Realm.Object<Subtitle> {
|
||
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<MJMessage> {
|
||
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 WebuiConfig extends Realm.Object<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
|
||
|
||
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<SDConfig> {
|
||
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<ReversePrompt> {
|
||
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<BookTaskDetailModel> {
|
||
id: string
|
||
no: number
|
||
name: string
|
||
bookId: string
|
||
bookTaskId: string
|
||
videoPath: 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 // 角色标签
|
||
gptPrompt: string | null // GPT提示词
|
||
mjMessage: MJMessage | null // MJ消息
|
||
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?',
|
||
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' },
|
||
gptPrompt: 'string?',
|
||
mjMessage: 'MJMessage?',
|
||
outImagePath: 'string?',
|
||
subImagePath: 'string[]',
|
||
imageLock: 'bool',
|
||
prompt: 'string?',
|
||
adetailer: 'bool',
|
||
sdConifg: 'SDConfig?',
|
||
subtitlePosition: 'string?',
|
||
status: "string",
|
||
createTime: 'date',
|
||
updateTime: 'date'
|
||
},
|
||
// 主键为_id
|
||
primaryKey: 'id'
|
||
}
|
||
}
|