V 4.0.5(2025.11.07)

1. 修复ComfyUI转视频初始化视频时长同步
2. 修复ComfyUI转视频工作流选择
3. 增加ComfyUI请求重试
This commit is contained in:
lq1405 2025-11-07 15:16:29 +08:00
parent b4ee555c03
commit 6b23ff2697
8 changed files with 86 additions and 32 deletions

2
.gitignore vendored
View File

@ -11,3 +11,5 @@ Database
build
src/renderer/src/components/Original/MainHome/OriginalTaskCard.vue
resources/image/预设
resources/scripts/db/option.realm
resources/scripts/db/option.realm.lock

View File

@ -1,7 +1,7 @@
{
"name": "laitool-pro",
"productName": "LaiToolPro",
"version": "v4.0.4",
"version": "v4.0.5",
"description": "来推 Pro - 一款集音频处理、文案生成、图片生成、视频生成等功能于一体的多合一AI工具软件。",
"main": "./out/main/index.js",
"author": "xiangbei",

View File

@ -0,0 +1,3 @@
{
"notInstall": false
}

View File

@ -18,13 +18,9 @@ import { BookTaskModel } from '../../model/bookTask'
import { PresetModel } from '../../model/preset'
import { define } from '@/define/define'
import { WorkFlowModel } from '../../model/workflow'
const { app } = require('electron')
// Determine database path based on environment
const isDev = !app.isPackaged
let dbPath = isDev
? path.resolve(process.cwd(), 'Database/option.realm') // Development path
: path.resolve(app.getPath('userData'), '../laitool-pro/Database/option.realm') // Production path
import { CheckFileOrDirExist } from '@/define/Tools/file'
import { ValidateJson } from '@/define/Tools/validate'
import { isEmpty } from 'lodash'
// 版本迁移
const migration = (_oldRealm: Realm, _newRealm: Realm) => { }
@ -32,25 +28,41 @@ const migration = (_oldRealm: Realm, _newRealm: Realm) => { }
export class RealmBaseService extends BaseService {
static instance: RealmBaseService | null = null
protected realm: Realm | null = null
dbpath: string
protected constructor() {
super()
this.dbpath = dbPath
}
private async initDBPath() {
const { app } = require('electron')
let dbConfigPath = path.resolve(define.db_path, "dbconfig.json");
let hasConfig = true;
let notInstall = false;
if (!await CheckFileOrDirExist(dbConfigPath)) {
hasConfig = false;
} else {
let dbCinfigString = await fs.promises.readFile(dbConfigPath, 'utf-8')
if (isEmpty(dbCinfigString) || !ValidateJson(dbCinfigString)) {
hasConfig = false;
}
let dbConfig = hasConfig ? JSON.parse(dbCinfigString) : null;
notInstall = dbConfig?.notInstall;
}
// Determine database path based on environment
const isDev = !app.isPackaged
let dbPath = isDev
? path.resolve(process.cwd(), 'Database/option.realm') // Development path
: notInstall == true ? path.resolve(define.db_path, "option.realm") : path.resolve(app.getPath('userData'), '../laitool-pro/Database/option.realm') // Production path
return dbPath
}
public static async getInstance() {
if (RealmBaseService.instance === null) {
// 将数写道本地文件
await fs.promises.writeFile(path.join(process.cwd(), '123.txt'),
`
dbPath : ${dbPath}
resourcesPath : ${define.resources_path},
log_folder : ${define.log_folder}
image_path : ${define.image_path}
cache_path : ${define.cache_path}
__dirname : ${__dirname}
`, 'utf-8')
RealmBaseService.instance = new RealmBaseService()
await RealmBaseService.instance.open()
}
@ -64,6 +76,21 @@ export class RealmBaseService extends BaseService {
async open() {
try {
if (this.realm != null) return
const dbPath = await this.initDBPath()
// 将数写道本地文件
await fs.promises.writeFile(path.join(process.cwd(), '123.txt'),
`
dbPath : ${dbPath}
resourcesPath : ${define.resources_path},
log_folder : ${define.log_folder}
image_path : ${define.image_path}
cache_path : ${define.cache_path}
__dirname : ${__dirname}
`, 'utf-8')
// 判断当前全局是不是又当前这个
const config = {
schema: [
@ -81,7 +108,7 @@ export class RealmBaseService extends BaseService {
PresetModel,
WorkFlowModel
],
path: this.dbpath,
path: dbPath,
schemaVersion: 25, // 数据库版本号,修改时需要增加
migration: migration
}

View File

@ -201,7 +201,7 @@ export class BookVideoServiceHandle extends BookBasicHandle {
let duration = 5;
if (bookTaskDetail.endTime != null && bookTaskDetail.startTime != null) {
let d = (bookTaskDetail.endTime - bookTaskDetail.startTime) / 1000000;
let d = (bookTaskDetail.endTime - bookTaskDetail.startTime) / 1000.0;
duration = Math.ceil(d); // 向上取整
}

View File

@ -26,6 +26,7 @@ import { BookTaskDetail } from '@/define/model/book/bookTaskDetail'
import { VideoStatus } from '@/define/enum/video'
import { ResponseMessageType } from '@/define/enum/softwareEnum'
import { ComfyUIWorkflowType } from '@/define/enum/comfyuiEnum'
import { RetryWithBackoff } from '@/define/Tools/common'
export class ComfyUIServiceHandle extends SDServiceHandle {
constructor() {
@ -164,7 +165,10 @@ export class ComfyUIServiceHandle extends SDServiceHandle {
let comfyuiSimpleSetting = await this.GetComfyUISetting()
let workflow_file = comfyuiOptions.workflow_file ?? comfyuiSimpleSetting.imageToVideoSelectWorkflow ?? "";
let workflow_file = comfyuiOptions.workflow_file;
if (isEmpty(workflow_file)) {
workflow_file = comfyuiSimpleSetting.imageToVideoSelectWorkflow || "";
}
let prompt = videoMessage.prompt || comfyuiOptions.prompt || '';
let negativePrompt = comfyuiOptions.negative_prompt || '';
@ -283,7 +287,7 @@ export class ComfyUIServiceHandle extends SDServiceHandle {
data: data
};
let res = await axios(config);
let res = await RetryWithBackoff(async () => await axios(config), 5, 2000);
let resData = res.data;
@ -514,7 +518,7 @@ export class ComfyUIServiceHandle extends SDServiceHandle {
data: body
}
let res = await axios(config)
let res = await RetryWithBackoff(async () => await axios(config), 5, 2000);
let resData = res.data
// 判断是不是失败
if (resData.error) {
@ -900,7 +904,8 @@ export class ComfyUIServiceHandle extends SDServiceHandle {
}
}
let res = await axios.request(config)
let res = await RetryWithBackoff(async () => await axios.request(config), 5, 2000);
let resData = res.data
// 判断状态是失败还是成功
let data = resData[promptId]
@ -1005,7 +1010,7 @@ export class ComfyUIServiceHandle extends SDServiceHandle {
responseType: 'arraybuffer' as 'arraybuffer' // 明确指定类型
}
let res = await axios.request(config)
let res = await RetryWithBackoff(async () => axios.request(config), 5, 2000);
// 检查响应状态和类型
console.log(`图片下载状态: ${res.status}, 内容类型: ${res.headers['content-type']}`)

View File

@ -378,7 +378,6 @@ export function useWordGroupBase(initData) {
initData: data,
onSaveWord: (newWords) => {
da?.destroy()
debugger
for (let i = 0; i < data.value.length; i++) {
const element = data.value[i]
element.afterGpt = ''
@ -441,7 +440,6 @@ export function useWordGroupBase(initData) {
onPositiveClick: async () => {
try {
da?.destroy()
debugger
// 深度清理数据,移除不可序列化的属性
const cleanData = toRaw(data.value).map(item => ({

View File

@ -1,11 +1,30 @@
{
"latestVersion": "v4.0.4",
"updateDate": "2025-11-06",
"latestVersion": "v4.0.5",
"updateDate": "2025-11-07",
"updateInfo": [
{
"version": "v4.0.5",
"updateDate": "2025-11-07",
"status": "unreleased",
"changes": [
{
"type": "bugfix",
"description": "修复 ComfyUI 转视频工作流选择"
},
{
"type": "bugfix",
"description": "修复 ComfyUI 视频时长同步"
},
{
"type": "improvement",
"description": "增加 ComfyUI 请求重试"
}
]
},
{
"version": "v4.0.4",
"updateDate": "2025-11-06",
"status": "unreleased",
"status": "released",
"changes": [
{
"type": "add",