V 3.2.1 2024.11.9
1. (聚合推文)修复原创默认出图方式设置默认值 2. (聚合推文)优化出图显示 3. (聚合推文)添加图片上传功能,包括主图和选图区域 4. (聚合推文)新增图片缓存区,上传缓存图片(主图和选图区的图片),可以直接在当前小说所有的批次中的分镜中调用(下载到主图和选图区) 5. (聚合推文)添加一键修脸开关 6. (聚合推文)原创添加一键锁定 7. (聚合推文)新增小说批次任务显示当前所属小说 8. (聚合推文)小说批次任务状态显示优化 9. (聚合推文)优化后台任务状态显示 10. (聚合推文)原创,反推 一键生图 修复
This commit is contained in:
@@ -11,9 +11,9 @@ const fspromises = fs.promises
|
||||
* @param {*} path 文件或目录的路径
|
||||
* @returns true表示存在,false表示不存在
|
||||
*/
|
||||
export async function CheckFileOrDirExist(path) {
|
||||
export async function CheckFileOrDirExist(filePath) {
|
||||
try {
|
||||
await fspromises.access(path)
|
||||
await fspromises.access(filePath)
|
||||
return true // 文件或目录存在
|
||||
} catch (error) {
|
||||
return false // 文件或目录不存在
|
||||
|
||||
@@ -49,7 +49,8 @@ export class BookTaskModel extends Realm.Object<BookTaskModel> {
|
||||
backgroundMusic: string | null // 背景音乐ID
|
||||
friendlyReminder: string | null // 友情提示
|
||||
imageFolder: string | null
|
||||
imageStyle: string[] | null // 软件内置的样式
|
||||
imageStyle: string | null // 软件内置的样式
|
||||
cacheImageList: string[] | null // 缓存的图片列表
|
||||
autoAnalyzeCharacter: string | null // 自动分析角色设置
|
||||
customizeImageStyle: string[] | null // 自定义的样式
|
||||
videoConfig: string | null // 合成视频设置
|
||||
@@ -80,6 +81,7 @@ export class BookTaskModel extends Realm.Object<BookTaskModel> {
|
||||
friendlyReminder: 'string?',
|
||||
imageFolder: 'string?',
|
||||
subImageFolder: "string?[]",
|
||||
cacheImageList: 'string?[]',
|
||||
imageStyle: 'string?[]',
|
||||
autoAnalyzeCharacter: 'string?',
|
||||
customizeImageStyle: 'string?[]',
|
||||
|
||||
@@ -9,7 +9,7 @@ import { BaseRealmService } from './bookBasic'
|
||||
import { isEmpty } from 'lodash'
|
||||
import { OtherData } from '../../../enum/softwareEnum.js'
|
||||
import { BookBackTaskList } from '../../model/Book/BookBackTaskListModel.js'
|
||||
import { Book } from '../../../../model/book.js'
|
||||
import { Book } from '../../../../model/book/book.js'
|
||||
import { GeneralResponse } from '../../../../model/generalResponse.js'
|
||||
const { v4: uuidv4 } = require('uuid')
|
||||
|
||||
|
||||
@@ -197,6 +197,13 @@ const migration = (oldRealm: Realm, newRealm: Realm) => {
|
||||
newBookTask[i].draftDepend = ''
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 29) {
|
||||
const oldBookTask = oldRealm.objects('BookTask')
|
||||
const newBookTask = newRealm.objects('BookTask')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].cacheImageList = undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class BaseRealmService extends BaseService {
|
||||
@@ -238,7 +245,7 @@ export class BaseRealmService extends BaseService {
|
||||
BookTaskDetailModel
|
||||
],
|
||||
path: this.dbpath,
|
||||
schemaVersion: 27,
|
||||
schemaVersion: 29,
|
||||
migration: migration
|
||||
}
|
||||
this.realm = await Realm.open(config)
|
||||
|
||||
@@ -10,7 +10,7 @@ import { BaseRealmService } from './bookBasic.js'
|
||||
import { isEmpty } from 'lodash'
|
||||
import { FfmpegOptions } from '../../../../main/Service/ffmpegOptions.js'
|
||||
import { version } from '../../../../../package.json'
|
||||
import { Book } from '../../../../model/book.js'
|
||||
import { Book } from '../../../../model/book/book.js'
|
||||
import { GeneralResponse } from '../../../../model/generalResponse.js'
|
||||
|
||||
export class BookService extends BaseRealmService {
|
||||
@@ -205,7 +205,7 @@ export class BookService extends BaseRealmService {
|
||||
} else if (book.type == BookType.MJ_REVERSE) {
|
||||
imageCategory = BookImageCategory.MJ
|
||||
} else if (book.type == BookType.ORIGINAL) {
|
||||
imageCategory = global.config.defaultImageMode
|
||||
imageCategory = global.config.defaultImageMode ?? BookImageCategory.MJ
|
||||
} else {
|
||||
throw new Error('未知的小说类型')
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { cloneDeep, isEmpty } from 'lodash'
|
||||
import { JoinPath } from '../../../Tools/file'
|
||||
import { BookTaskDetailModel, ReversePrompt } from '../../model/Book/bookTaskDetail.js'
|
||||
const { v4: uuidv4 } = require('uuid')
|
||||
import { Book } from "../../../../model/book"
|
||||
import { Book } from "../../../../model/book/book"
|
||||
import { GeneralResponse } from '../../../../model/generalResponse.js'
|
||||
|
||||
let dbPath = path.resolve(define.db_path, 'book.realm')
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BaseRealmService } from './bookBasic'
|
||||
import { JoinPath } from '../../../Tools/file'
|
||||
import { BookBackTaskList } from '../../model/Book/BookBackTaskListModel.js'
|
||||
const { v4: uuidv4 } = require('uuid')
|
||||
import { Book } from '../../../../model/book'
|
||||
import { Book } from '../../../../model/book/book'
|
||||
import { TagDefine } from '../../../tagDefine.js'
|
||||
import { ImageStyleDefine } from "../../../../define/iamgeStyleDefine"
|
||||
import { cloneDeep } from 'lodash'
|
||||
@@ -89,6 +89,7 @@ export class BookTaskService extends BaseRealmService {
|
||||
srtPath: JoinPath(define.project_path, bookTask.srtPath),
|
||||
audioPath: JoinPath(define.project_path, bookTask.audioPath),
|
||||
imageFolder: JoinPath(define.project_path, bookTask.imageFolder),
|
||||
cacheImageList: bookTask.cacheImageList ? Array.from(bookTask.cacheImageList).map(item => JoinPath(define.project_path, item)) : [],
|
||||
imageCategory: bookTask.imageCategory ? bookTask.imageCategory : BookImageCategory.MJ, // 默认使用MJ出图
|
||||
} as Book.SelectBookTask;
|
||||
})
|
||||
|
||||
@@ -150,7 +150,9 @@ define['hkServerUrl'] = 'https://laitool.net/'
|
||||
define['bakServerUrl'] = 'https://laitool.net/'
|
||||
define['API'] = 'f85d39ed5a40fd09966f13f12b6cf0f0'
|
||||
|
||||
define['lms'] =
|
||||
process.env.NODE_ENV == 'development' ? 'https://localhost:44362' : 'https://lms.laitool.cn'
|
||||
// define['lms'] =
|
||||
// process.env.NODE_ENV == 'development' ? 'https://localhost:44362' : 'https://lms.laitool.cn'
|
||||
|
||||
define['lms'] = 'https://lms.laitool.cn'
|
||||
|
||||
export { define }
|
||||
|
||||
@@ -107,6 +107,18 @@ const BOOK = {
|
||||
/** 添加一键生图后台任务 */
|
||||
GENERATE_ALL_TASK_IMAGE: "GENERATE_ALL_TASK_IMAGE",
|
||||
|
||||
/** 上传图片到小说中,并修改小说信息 */
|
||||
UPLOAD_IMAGE_TO_BOOK_AND_UPDATE_MESSAGE: "UPLOAD_IMAGE_TO_BOOK_AND_UPDATE_MESSAGE",
|
||||
|
||||
/** 上传图片到缓存 */
|
||||
UPLOAD_IMAGE_TO_CACHE: "UPLOAD_IMAGE_TO_CACHE",
|
||||
|
||||
/** 获取当前小说中的所有的批次中的缓存图片 */
|
||||
GET_ALL_BOOK_TASK_IMAGE_CACHE: "GET_ALL_BOOK_TASK_IMAGE_CACHE",
|
||||
|
||||
/** 保存缓存区的屠图片到小说主图或者是选图区 */
|
||||
SAVE_CACHE_IMAGE_TO_DATA: "SAVE_CACHE_IMAGE_TO_DATA",
|
||||
|
||||
//#endregion
|
||||
|
||||
COMPUTE_STORYBOARD: 'COMPUTE_STORYBOARD',
|
||||
|
||||
@@ -10,5 +10,11 @@ export const SYSTEM = {
|
||||
/** 检查机器码状态 */
|
||||
CHECK_MACHINE_STATUS: "CHECK_MACHINE_STATUS",
|
||||
/** 获取软件版本信息,更新信息,首页内容,公告等 */
|
||||
GET_REMOTE_SYSTEM_INFORMATION: 'GET_REMOTE_SYSTEM_INFORMATION'
|
||||
GET_REMOTE_SYSTEM_INFORMATION: 'GET_REMOTE_SYSTEM_INFORMATION',
|
||||
|
||||
/** 选择单个指定文件后缀的文件 */
|
||||
SELECT_SINGLE_FILE: "SELECT_SINGLE_FILE",
|
||||
|
||||
/** 选择多个指定文件后缀的文件 */
|
||||
SELECT_MULTIPLE_FILE: "SELECT_MULTIPLE_FILE",
|
||||
}
|
||||
+195
-40
@@ -1,3 +1,5 @@
|
||||
import { TaskModal } from "@/model/task";
|
||||
|
||||
export enum BookType {
|
||||
// 原创
|
||||
ORIGINAL = 'original',
|
||||
@@ -333,70 +335,194 @@ export function GetBookBackTaskTypeLabel(key: string) {
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
export function GetBookTaskDetailStatusLabel(key: string) {
|
||||
export function GetBookTaskDetailStatusLabel(key: string): TaskModal.TaskStatus {
|
||||
switch (key) {
|
||||
case BookTaskStatus.WAIT:
|
||||
return '等待';
|
||||
return {
|
||||
status: BookTaskStatus.WAIT,
|
||||
label: '等待',
|
||||
type: 'warning'
|
||||
};
|
||||
case BookTaskStatus.STORYBOARD:
|
||||
return '分镜计算中';
|
||||
return {
|
||||
status: BookTaskStatus.STORYBOARD,
|
||||
label: '分镜计算中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.STORYBOARD_FAIL:
|
||||
return '分镜计算失败';
|
||||
return {
|
||||
status: BookTaskStatus.STORYBOARD_FAIL,
|
||||
label: '分镜计算失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.STORYBOARD_DONE:
|
||||
return '分镜计算完成';
|
||||
return {
|
||||
status: BookTaskStatus.STORYBOARD_DONE,
|
||||
label: '分镜计算完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.SPLIT:
|
||||
return '分割视频中';
|
||||
return {
|
||||
status: BookTaskStatus.SPLIT,
|
||||
label: '分割视频中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.SPLIT_FAIL:
|
||||
return '分割视频失败';
|
||||
return {
|
||||
status: BookTaskStatus.SPLIT_FAIL,
|
||||
label: '分割视频失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.SPLIT_DONE:
|
||||
return '分割视频完成';
|
||||
return {
|
||||
status: BookTaskStatus.SPLIT_DONE,
|
||||
label: '分割视频完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.AUDIO:
|
||||
return '提取音频中';
|
||||
return {
|
||||
status: BookTaskStatus.AUDIO,
|
||||
label: '提取音频中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.AUDIO_FAIL:
|
||||
return '提取音频失败';
|
||||
return {
|
||||
status: BookTaskStatus.AUDIO_FAIL,
|
||||
label: '提取音频失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.AUDIO_DONE:
|
||||
return '提取音频完成';
|
||||
return {
|
||||
status: BookTaskStatus.AUDIO_DONE,
|
||||
label: '提取音频完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.RECOGNIZE:
|
||||
return '识别字幕中';
|
||||
return {
|
||||
status: BookTaskStatus.RECOGNIZE,
|
||||
label: '识别字幕中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.RECOGNIZE_FAIL:
|
||||
return '识别字幕失败';
|
||||
return {
|
||||
status: BookTaskStatus.RECOGNIZE_FAIL,
|
||||
label: '识别字幕失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.RECOGNIZE_DONE:
|
||||
return '识别字幕完成';
|
||||
return {
|
||||
status: BookTaskStatus.RECOGNIZE_DONE,
|
||||
label: '识别字幕完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.FRAME:
|
||||
return '抽帧中';
|
||||
return {
|
||||
status: BookTaskStatus.FRAME,
|
||||
label: '抽帧中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.FRAME_FAIL:
|
||||
return '抽帧失败';
|
||||
return {
|
||||
status: BookTaskStatus.FRAME_FAIL,
|
||||
label: '抽帧失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.FRAME_DONE:
|
||||
return '抽帧完成';
|
||||
return {
|
||||
status: BookTaskStatus.FRAME_DONE,
|
||||
label: '抽帧完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.REVERSE:
|
||||
return '反推中';
|
||||
return {
|
||||
status: BookTaskStatus.REVERSE,
|
||||
label: '反推中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.REVERSE_FAIL:
|
||||
return '反推失败';
|
||||
return {
|
||||
status: BookTaskStatus.REVERSE_FAIL,
|
||||
label: '反推失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.REVERSE_DONE:
|
||||
return '反推完成';
|
||||
return {
|
||||
status: BookTaskStatus.REVERSE_DONE,
|
||||
label: '反推完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.IMAGE:
|
||||
return '生成图片中';
|
||||
return {
|
||||
status: BookTaskStatus.IMAGE,
|
||||
label: '生成图片中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.IMAGE_FAIL:
|
||||
return '生成图片失败';
|
||||
return {
|
||||
status: BookTaskStatus.IMAGE_FAIL,
|
||||
label: '生成图片失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.IMAGE_DONE:
|
||||
return '生成图片完成';
|
||||
return {
|
||||
status: BookTaskStatus.IMAGE_DONE,
|
||||
label: '生成图片完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.HD:
|
||||
return '高清中';
|
||||
return {
|
||||
status: BookTaskStatus.HD,
|
||||
label: '高清中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.HD_FAIL:
|
||||
return '高清失败';
|
||||
return {
|
||||
status: BookTaskStatus.HD_FAIL,
|
||||
label: '高清失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.HD_DONE:
|
||||
return '高清完成';
|
||||
return {
|
||||
status: BookTaskStatus.HD_DONE,
|
||||
label: '高清完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.COMPOSING:
|
||||
return '合成视频中';
|
||||
return {
|
||||
status: BookTaskStatus.COMPOSING,
|
||||
label: '合成视频中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookTaskStatus.COMPOSING_FAIL:
|
||||
return '合成视频失败';
|
||||
return {
|
||||
status: BookTaskStatus.COMPOSING_FAIL,
|
||||
label: '合成视频失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookTaskStatus.COMPOSING_DONE:
|
||||
return '合成视频完成';
|
||||
return {
|
||||
status: BookTaskStatus.COMPOSING_DONE,
|
||||
label: '合成视频完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.DRAFT_DONE:
|
||||
return '添加草稿完成';
|
||||
return {
|
||||
status: BookTaskStatus.DRAFT_DONE,
|
||||
label: '添加草稿完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookTaskStatus.DRAFT_FAIL:
|
||||
return '添加草稿失败';
|
||||
return {
|
||||
status: BookTaskStatus.DRAFT_FAIL,
|
||||
label: '添加草稿失败',
|
||||
type: 'error'
|
||||
};
|
||||
default:
|
||||
return key;
|
||||
return {
|
||||
status: "UNKNOWN",
|
||||
label: "UNKNOWN",
|
||||
type: 'warning'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,21 +531,50 @@ export function GetBookTaskDetailStatusLabel(key: string) {
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
export function GetBookBackTaskStatusLabel(key: string) {
|
||||
export function GetBookBackTaskStatusLabel(key: string): TaskModal.TaskStatus {
|
||||
|
||||
switch (key) {
|
||||
case BookBackTaskStatus.WAIT:
|
||||
return '等待';
|
||||
return {
|
||||
status: BookBackTaskStatus.WAIT,
|
||||
label: '等待',
|
||||
type: 'warning'
|
||||
};
|
||||
case BookBackTaskStatus.RUNNING:
|
||||
return '运行中';
|
||||
return {
|
||||
status: BookBackTaskStatus.RUNNING,
|
||||
label: '运行中',
|
||||
type: 'info'
|
||||
};
|
||||
case BookBackTaskStatus.PAUSE:
|
||||
return '暂停';
|
||||
return {
|
||||
status: BookBackTaskStatus.PAUSE,
|
||||
label: '暂停',
|
||||
type: 'warning'
|
||||
};
|
||||
case BookBackTaskStatus.DONE:
|
||||
return '完成';
|
||||
return {
|
||||
status: BookBackTaskStatus.DONE,
|
||||
label: '完成',
|
||||
type: 'success'
|
||||
};
|
||||
case BookBackTaskStatus.FAIL:
|
||||
return '失败';
|
||||
return {
|
||||
status: BookBackTaskStatus.FAIL,
|
||||
label: '失败',
|
||||
type: 'error'
|
||||
};
|
||||
case BookBackTaskStatus.RECONNECT:
|
||||
return '重连';
|
||||
return {
|
||||
status: BookBackTaskStatus.RECONNECT,
|
||||
label: '重连',
|
||||
type: 'warning'
|
||||
};
|
||||
default:
|
||||
return key;
|
||||
return {
|
||||
status: "UNKNOWN",
|
||||
label: "UNKNOWN",
|
||||
type: 'warning'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user