V 3.3.6(2025.05.08)
1. 新增推理模式-Laitool分镜大师-全面版 2. 修复comfyui合并提示词 3. 完善停止后台任务
This commit is contained in:
@@ -139,6 +139,7 @@ import { SubtitleSavePositionType } from '../../../../../define/enum/waterMarkAn
|
||||
import { DEFINE_STRING } from '../../../../../define/define_string/index.ts'
|
||||
import Setting from './SettingTabs.vue'
|
||||
import {
|
||||
BookBackTaskStatus,
|
||||
BookBackTaskType,
|
||||
BookImageCategory,
|
||||
BookType,
|
||||
@@ -473,6 +474,8 @@ async function handleSelect(key) {
|
||||
case 'generate_space_image': //生成未生成的图片
|
||||
await GenerateImageAll(false)
|
||||
break
|
||||
case 'stop_image_generate':
|
||||
await StopImageGenerate()
|
||||
|
||||
case 'translate_setting': // 翻译设置
|
||||
await Translate('translate_setting')
|
||||
@@ -915,6 +918,82 @@ async function GenerateImageAll(cover = true) {
|
||||
})
|
||||
}
|
||||
|
||||
// 停止任务
|
||||
async function StopTask(taskTypes, condition) {
|
||||
let stopTasks = []
|
||||
for (let i = 0; i < taskTypes.length; i++) {
|
||||
const element = taskTypes[i]
|
||||
let taskRes = await window.task.GetBackTaskCollection({
|
||||
...condition,
|
||||
taskType: element
|
||||
})
|
||||
if (taskRes.code != 1) {
|
||||
message.error(taskRes.message)
|
||||
return
|
||||
}
|
||||
if (taskRes.data?.data.length > 0) {
|
||||
stopTasks.push(...taskRes.data?.data)
|
||||
}
|
||||
}
|
||||
|
||||
if (stopTasks.length <= 0) {
|
||||
message.error('没有需要停止的任务')
|
||||
return
|
||||
}
|
||||
|
||||
// 开始执行停止的任务
|
||||
for (let i = 0; i < stopTasks.length; i++) {
|
||||
const element = stopTasks[i]
|
||||
let res = await window.task.UpdateTaskStatus({
|
||||
id: element.id,
|
||||
status: BookBackTaskStatus.FAIL,
|
||||
errorMessage: '用户手动取消了任务'
|
||||
})
|
||||
if (res.code != 1) {
|
||||
message.error(res.message)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function StopImageGenerate() {
|
||||
let da = dialog.warning({
|
||||
title: '停止生成图片提示',
|
||||
content: '继续操作会停止当前批次的生成图片的任务,是否继续?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
try {
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在停止当前批次的生成图片任务,请稍后。。。'
|
||||
let taskTypes = [
|
||||
BookBackTaskType.MJ_IMAGE,
|
||||
BookBackTaskType.FLUX_API_IMAGE,
|
||||
BookBackTaskType.FLUX_FORGE_IMAGE,
|
||||
BookBackTaskType.SD_IMAGE,
|
||||
BookBackTaskType.ComfyUI_IMAGE,
|
||||
BookBackTaskType.D3_IMAGE
|
||||
]
|
||||
let queryCondition = {
|
||||
bookTaskName: reverseManageStore.selectBookTask.name,
|
||||
taskStatus: BookBackTaskStatus.WAIT,
|
||||
page: 1,
|
||||
pageSize: 10000
|
||||
}
|
||||
await StopTask(taskTypes, queryCondition)
|
||||
|
||||
// 成功
|
||||
message.success('停止当前批次的生成图片任务成功')
|
||||
} catch (error) {
|
||||
message.error('停止当前批次的生成图片任务失败,' + error.message)
|
||||
} finally {
|
||||
softwareStore.spin.spinning = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入文案和SRT
|
||||
*/
|
||||
|
||||
@@ -93,8 +93,10 @@ async function SingleMergePrompt() {
|
||||
mergeType = 'sd_merge'
|
||||
} else if (image_generate_category == 'flux-api' || image_generate_category == 'flux-forge') {
|
||||
mergeType = 'sd_merge'
|
||||
} else if (image_generate_category == 'comfyui') {
|
||||
mergeType = 'sd_merge'
|
||||
} else {
|
||||
throw new Error('未知的合并模式,请检查')
|
||||
message.error('未知的合并模式,请检查')
|
||||
}
|
||||
|
||||
let res = await window.book.MergePrompt(row.value.id, mergeType, OperateBookType.BOOKTASKDETAIL)
|
||||
|
||||
@@ -80,6 +80,7 @@ import CharacterAnalyze from '../Components/PresetLibrary/CharacterAnalyze.vue'
|
||||
import PromptSetting from '../../Original/Components/PromptSetting.vue'
|
||||
import MonitorStatus from '../MJReverse/MonitorStatus.vue'
|
||||
import {
|
||||
BookBackTaskStatus,
|
||||
BookBackTaskType,
|
||||
BookImageCategory,
|
||||
BookType,
|
||||
@@ -101,7 +102,8 @@ let GptButtonOptions = ref([
|
||||
])
|
||||
let GenerateImageOptions = ref([
|
||||
{ label: '生成未出图分镜', key: 'generate_space_image' },
|
||||
{ label: '停止生成图片任务', key: 'stop_generate_image' }
|
||||
{ label: '停止生成图片任务(当前批次)', key: 'stop_generate_image_this' },
|
||||
{ label: '停止生成图片任务(所有批次)', key: 'stop_generate_image_all' }
|
||||
])
|
||||
let ResetDataOptions = ref([
|
||||
{ label: '重置GPT提示词', key: 'reset_prompt' },
|
||||
@@ -341,6 +343,10 @@ async function ButtonSelect(key) {
|
||||
} else if (key == 'generate_space_image') {
|
||||
// 生成未出图分镜
|
||||
await GenerateImageAll(false)
|
||||
} else if (key == 'stop_generate_image_this') {
|
||||
await StopGenerateImageThis()
|
||||
} else if (key == 'stop_generate_image_all') {
|
||||
await StopGenerateImageAll()
|
||||
} else if (key == 'reset_merge_prompt') {
|
||||
// 重置合并提示词
|
||||
await ResetMergePrompt()
|
||||
@@ -491,6 +497,122 @@ async function GenerateImageAll(cover = true) {
|
||||
})
|
||||
}
|
||||
|
||||
// 停止任务
|
||||
async function StopTask(taskTypes, condition) {
|
||||
let stopTasks = []
|
||||
for (let i = 0; i < taskTypes.length; i++) {
|
||||
const element = taskTypes[i]
|
||||
let taskRes = await window.task.GetBackTaskCollection({
|
||||
...condition,
|
||||
taskType: element
|
||||
})
|
||||
if (taskRes.code != 1) {
|
||||
message.error(taskRes.message)
|
||||
return
|
||||
}
|
||||
if (taskRes.data?.data.length > 0) {
|
||||
stopTasks.push(...taskRes.data?.data)
|
||||
}
|
||||
}
|
||||
|
||||
if (stopTasks.length <= 0) {
|
||||
message.error('没有需要停止的任务')
|
||||
return
|
||||
}
|
||||
|
||||
// 开始执行停止的任务
|
||||
for (let i = 0; i < stopTasks.length; i++) {
|
||||
const element = stopTasks[i]
|
||||
let res = await window.task.UpdateTaskStatus({
|
||||
id: element.id,
|
||||
status: BookBackTaskStatus.FAIL,
|
||||
errorMessage: '用户手动取消了任务'
|
||||
})
|
||||
if (res.code != 1) {
|
||||
message.error(res.message)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 停止当前批次的生成图片任务
|
||||
async function StopGenerateImageThis() {
|
||||
let da = dialog.warning({
|
||||
title: '停止生成图片提示',
|
||||
content: `即将开始停止当前批次正在等待中的出图任务(执行中的任务不可取消),是否继续?`,
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
try {
|
||||
debugger
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在停止当前批次的生成图片任务,请稍后。。。'
|
||||
let taskTypes = [
|
||||
BookBackTaskType.MJ_IMAGE,
|
||||
BookBackTaskType.FLUX_API_IMAGE,
|
||||
BookBackTaskType.FLUX_FORGE_IMAGE,
|
||||
BookBackTaskType.SD_IMAGE,
|
||||
BookBackTaskType.ComfyUI_IMAGE,
|
||||
BookBackTaskType.D3_IMAGE
|
||||
]
|
||||
let queryCondition = {
|
||||
bookTaskName: reverseManageStore.selectBookTask.name,
|
||||
taskStatus: BookBackTaskStatus.WAIT,
|
||||
page: 1,
|
||||
pageSize: 10000
|
||||
}
|
||||
await StopTask(taskTypes, queryCondition)
|
||||
|
||||
// 成功
|
||||
message.success('停止当前批次的生成图片任务成功')
|
||||
} catch (error) {
|
||||
message.error('停止当前批次的生成图片任务失败,' + error.message)
|
||||
} finally {
|
||||
softwareStore.spin.spinning = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 停止所有批次的生成图片任务
|
||||
async function StopGenerateImageAll() {
|
||||
let da = dialog.warning({
|
||||
title: '停止生成图片提示',
|
||||
content: `即将开始停止所有批次正在等待中的出图任务(执行中的任务不可取消),是否继续?`,
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
try {
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在停止所有批次的生成图片任务,请稍后。。。'
|
||||
let taskTypes = [
|
||||
BookBackTaskType.MJ_IMAGE,
|
||||
BookBackTaskType.FLUX_API_IMAGE,
|
||||
BookBackTaskType.FLUX_FORGE_IMAGE,
|
||||
BookBackTaskType.SD_IMAGE,
|
||||
BookBackTaskType.ComfyUI_IMAGE,
|
||||
BookBackTaskType.D3_IMAGE
|
||||
]
|
||||
let queryCondition = {
|
||||
taskStatus: BookBackTaskStatus.WAIT,
|
||||
page: 1,
|
||||
pageSize: 10000
|
||||
}
|
||||
await StopTask(taskTypes, queryCondition)
|
||||
|
||||
// 成功
|
||||
message.success('停止所有批次的生成图片任务成功')
|
||||
} catch (error) {
|
||||
message.error('停止所有批次的生成图片任务失败,' + error.message)
|
||||
} finally {
|
||||
softwareStore.spin.spinning = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开新的弹窗
|
||||
*/
|
||||
|
||||
@@ -276,8 +276,8 @@ onMounted(async () => {
|
||||
dialog.create({
|
||||
type: type,
|
||||
title: title,
|
||||
showIcon: true,
|
||||
content: message,
|
||||
showIcon: true,
|
||||
style: `width : 400px;`,
|
||||
maskClosable: false,
|
||||
positiveText: '确定'
|
||||
|
||||
Reference in New Issue
Block a user