LaiTool/src/define/db/model/Book/bookTaskDetail.ts

194 lines
5.1 KiB
TypeScript
Raw Normal View History

2024-06-24 13:11:19 +08:00
import Realm, { ObjectSchema } from 'realm'
import {
BookBackTaskStatus,
BookBackTaskType,
BookTaskStatus,
BookType,
MJAction,
} from '../../../enum/bookEnum'
2024-08-03 12:46:12 +08:00
import { MJImageType } from '../../../enum/mjEnum'
2024-06-24 13:11:19 +08:00
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
2024-08-03 12:46:12 +08:00
category: MJImageType
2024-06-24 13:11:19 +08:00
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'
}
}
2024-08-03 12:46:12 +08:00
// 放反推的提示词的对象
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'
}
}
2024-06-24 13:11:19 +08:00
export class BookTaskDetailModel extends Realm.Object<BookTaskDetailModel> {
id: string
no: number
name: string
bookId: string
bookTaskId: string
videoPath: string | null // 视频地址
2024-06-27 16:24:41 +08:00
audioPath: string | null // 音频地址
2024-06-24 13:11:19 +08:00
word: string | null // 文案
oldImage: string | null // 旧图片用于SD的图生图
afterGpt: string | null // GPT生成的文案
startTime: number | null // 开始时间
endTime: number | null // 结束时间
timeLimit: string | null // 事件实现0 -- 3000
2024-08-03 12:46:12 +08:00
subValue: string | null // 包含的字幕数据
2024-06-24 13:11:19 +08:00
characterTags: string[] | null // 角色标签
gptPrompt: string | null // GPT提示词
mjMessage: MJMessage | null // MJ消息
outImagePath: string | null // 输出图片地址
2024-06-27 16:24:41 +08:00
subImagePath: string[] | null // 子图片地址
2024-08-03 12:46:12 +08:00
imageLock: boolean // 图片锁
2024-06-24 13:11:19 +08:00
prompt: string | null // 提示
adetailer: boolean // 是否开启修脸
sdConifg: SDConfig | null // SD配置
2024-08-03 12:46:12 +08:00
reversePrompt: ReversePrompt[] | null // 反推的提示词(数组)
2024-07-13 15:44:13 +08:00
subtitlePosition: string | null // 字幕位置
2024-08-03 12:46:12 +08:00
status: BookTaskStatus
2024-06-24 13:11:19 +08:00
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?',
2024-06-27 16:24:41 +08:00
audioPath: 'string?',
2024-06-24 13:11:19 +08:00
word: 'string?',
oldImage: 'string?',
afterGpt: 'string?',
startTime: 'int?',
endTime: 'int?',
timeLimit: 'string?',
2024-08-03 12:46:12 +08:00
subValue: 'string?',
reversePrompt: { type: 'list', objectType: 'ReversePrompt' },
2024-06-24 13:11:19 +08:00
characterTags: { type: 'list', objectType: 'string' },
gptPrompt: 'string?',
mjMessage: 'MJMessage?',
outImagePath: 'string?',
subImagePath: 'string[]',
2024-08-03 12:46:12 +08:00
imageLock: 'bool',
2024-06-24 13:11:19 +08:00
prompt: 'string?',
adetailer: 'bool',
sdConifg: 'SDConfig?',
2024-07-13 15:44:13 +08:00
subtitlePosition: 'string?',
2024-08-03 12:46:12 +08:00
status: "string",
2024-06-24 13:11:19 +08:00
createTime: 'date',
updateTime: 'date'
},
// 主键为_id
primaryKey: 'id'
}
}