LaiTool V3.1.2
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div style="height: 135px; width : 100%;overflow: auto; display: flex; margin: auto">
|
||||
<div v-if="data.subValue && data.subValue.length != 0" style="width : 100%">
|
||||
<div v-for="(item, index) in data.subValue" style="width : 100%">
|
||||
<div style="height: 135px; width: 100%; overflow: auto; display: flex; margin: auto">
|
||||
<div v-if="data.subValue && data.subValue.length != 0" style="width: 100%">
|
||||
<div v-for="(item, index) in data.subValue" style="width: 100%">
|
||||
<n-input
|
||||
v-model:value="item.srt_value"
|
||||
type="textarea"
|
||||
style="width : 100%"
|
||||
style="width: 100%"
|
||||
size="tiny"
|
||||
:autosize="{ minRows: 1, maxRows: 5 }"
|
||||
@input="InputDebounced"
|
||||
@@ -26,7 +26,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, defineComponent, onUnmounted, toRaw, watch, computed } from 'vue'
|
||||
import { ref, onMounted, defineComponent } from 'vue'
|
||||
import { useMessage, NInput } from 'naive-ui'
|
||||
import { debounce } from 'lodash'
|
||||
|
||||
@@ -35,6 +35,7 @@ export default defineComponent({
|
||||
props: ['initData', 'index'],
|
||||
setup(props) {
|
||||
let data = ref(props.initData)
|
||||
console.log('data', props.initData, props.index)
|
||||
onMounted(async () => {})
|
||||
let InputDebounced = debounce(handleInput, 1000)
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
type="info"
|
||||
style="font-size: 24px; position: absolute; left: 8px; top: -5px"
|
||||
@click="DownloadImage"
|
||||
v-if="reverseManageStore.selectBookTask.imageCategory == 'mj'"
|
||||
>
|
||||
<n-icon>
|
||||
<Download />
|
||||
@@ -116,7 +117,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { ref, onMounted, toRaw, watch } from 'vue'
|
||||
import {
|
||||
NImage,
|
||||
useDialog,
|
||||
@@ -132,6 +133,8 @@ import { LockClosed, LockOpen, Download } from '@vicons/ionicons5'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import { useImageStore } from '../../../../../stores/image'
|
||||
import { BookImageCategory, OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
import { isEmpty } from 'lodash'
|
||||
let props = defineProps({
|
||||
initData: undefined,
|
||||
index: undefined
|
||||
@@ -268,53 +271,55 @@ async function ModifyLock() {
|
||||
*/
|
||||
async function DownloadImage() {
|
||||
// 目前只能判断是不是有mj_message
|
||||
dialog.warning({
|
||||
let da = dialog.warning({
|
||||
title: '下载图片警告',
|
||||
content: '单个图片的下载,只支持 MJ API 生图,当前有图片的话会被覆盖掉,是否继续?',
|
||||
content:
|
||||
'单个图片的下载,只支持 MJ API 生图,MJ图片有效时间大约为24小时,当前有图片的话会被覆盖掉,是否继续?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
if (data.value.mj_message) {
|
||||
debugger
|
||||
// 加判断
|
||||
// 只要状态不是success 和 error ,其他的都重新获取
|
||||
if (data.value.mj_message.status == 'error') {
|
||||
message.error('失败状态不能采集图片')
|
||||
return
|
||||
}
|
||||
if (isEmpty(data.value.mj_message.message_id)) {
|
||||
message.error('没有消息ID,不能采集图片')
|
||||
return
|
||||
}
|
||||
window.mj.GetGeneratedMJImageAndSplit(JSON.stringify([toRaw(data.value)]), (value) => {
|
||||
if (value.code == 0) {
|
||||
message.error(value.message)
|
||||
return
|
||||
}
|
||||
// 修改数据
|
||||
for (let i = 0; i < value.data.length; i++) {
|
||||
const element = value.data[i]
|
||||
// 修改对应的数据
|
||||
data.value.outImagePath =
|
||||
'file://' +
|
||||
element.outImagePath.replaceAll('\\', '/') +
|
||||
'?time=' +
|
||||
new Date().getTime()
|
||||
|
||||
data.value.subImagePath = element.subImagePath.map(
|
||||
(item) => 'file://' + item.replaceAll('\\', '/') + '?time=' + new Date().getTime()
|
||||
)
|
||||
data.value.mj_message.image_click = element.result
|
||||
data.value.mj_message.image_path = element.image_path
|
||||
data.value.mj_message.progress = 100
|
||||
data.value.mj_message.status = 'success'
|
||||
}
|
||||
})
|
||||
} else if (data.value.mjMessage) {
|
||||
message.error('暂时不支持')
|
||||
da?.destroy()
|
||||
if (reverseManageStore.selectBookTask.imageCategory != BookImageCategory.MJ) {
|
||||
message.error('当前图片不是MJ图片,不能下载')
|
||||
return
|
||||
}
|
||||
// 只要状态不是success 和 error ,其他的都重新获取
|
||||
if (data.value.mjMessage.status == 'error') {
|
||||
message.error('失败状态不能采集图片')
|
||||
return
|
||||
}
|
||||
if (isEmpty(data.value.mjMessage.messageId)) {
|
||||
message.error('没有消息ID,不能采集图片')
|
||||
return
|
||||
}
|
||||
|
||||
// 开始下载图片
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在下载图片,请稍后...'
|
||||
let res = await window.book.GetImageUrlAndDownload(
|
||||
data.value.id,
|
||||
OperateBookType.BOOKTASKDETAIL,
|
||||
false
|
||||
)
|
||||
softwareStore.spin.spinning = false
|
||||
if (res.code == 1) {
|
||||
// 这边要修改下数据
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
const element = res.data[i]
|
||||
let findIndex = reverseManageStore.selectBookTaskDetail.findIndex(
|
||||
(item) => item.id == element.id
|
||||
)
|
||||
if (findIndex != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].outImagePath =
|
||||
element.data.outImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].subImagePath =
|
||||
element.data.subImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].mjMessage = element.data.mjMessage
|
||||
}
|
||||
}
|
||||
message.success(res.message)
|
||||
} else {
|
||||
message.error('没有生图数据')
|
||||
message.error(res.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+5
-1
@@ -65,7 +65,11 @@ async function ReplaceAfterGpt() {
|
||||
(x) => x.id == element.bookTaskDetailId
|
||||
)
|
||||
if (index != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[index].afterGpt = element.newData
|
||||
if (element.type == 'subValue') {
|
||||
reverseManageStore.selectBookTaskDetail[index].subValue = element.newData
|
||||
} else {
|
||||
reverseManageStore.selectBookTaskDetail[index].afterGpt = element.newData
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (props.type == BookRepalceDataType.GPT_PROMPT) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div style="display: flex">
|
||||
<div style="display: flex; align-items: center">
|
||||
<span>出图</span>
|
||||
<n-select
|
||||
style="width: 100px; margin-left: 5px"
|
||||
@@ -9,20 +9,29 @@
|
||||
v-model:value="reverseManageStore.selectBookTask.imageCategory"
|
||||
placeholder="选择生图模式"
|
||||
></n-select>
|
||||
<n-button
|
||||
v-if="reverseManageStore.selectBookTask.imageCategory == 'mj'"
|
||||
color="#7c461e"
|
||||
size="tiny"
|
||||
style="margin-left: 5px"
|
||||
@click="MJGetImage"
|
||||
>MJ采集图片</n-button
|
||||
>
|
||||
<div v-if="reverseManageStore.selectBookTask.imageCategory == 'mj'">
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
text
|
||||
type="info"
|
||||
color="#e18a3b"
|
||||
style="font-size: 24px; margin-left: 5px"
|
||||
@click="DownloadAllImage"
|
||||
>
|
||||
<n-icon> <Download /> </n-icon>
|
||||
</n-button>
|
||||
</template>
|
||||
<span>MJ采集全部图片</span>
|
||||
</n-popover>
|
||||
</div>
|
||||
|
||||
<n-button
|
||||
v-if="reverseManageStore.selectBookTask.imageCategory == 'mj'"
|
||||
color="#e18a3b"
|
||||
size="tiny"
|
||||
style="margin-left: 5px"
|
||||
@click="OneSplitFour"
|
||||
@click="OneToFourBookTask"
|
||||
>1拆4</n-button
|
||||
>
|
||||
</div>
|
||||
@@ -30,11 +39,14 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { NSelect, NButton, useMessage } from 'naive-ui'
|
||||
import { NSelect, NButton, useMessage, useDialog, NPopover, NIcon } from 'naive-ui'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import { Download } from '@vicons/ionicons5'
|
||||
import { OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
let softwareStore = useSoftwareStore()
|
||||
let message = useMessage()
|
||||
let dialog = useDialog()
|
||||
let reverseManageStore = useReverseManageStore()
|
||||
let image_options = ref([])
|
||||
|
||||
@@ -49,6 +61,7 @@ onMounted(async () => {
|
||||
})
|
||||
})
|
||||
|
||||
// 更行生图方式
|
||||
async function UpdateImageGenerateCategory(value, options) {
|
||||
// 调用下保存
|
||||
let res = await window.db.UpdateBookTaskData(reverseManageStore.selectBookTask.id, {
|
||||
@@ -56,4 +69,59 @@ async function UpdateImageGenerateCategory(value, options) {
|
||||
})
|
||||
window.api.showGlobalMessage(res)
|
||||
}
|
||||
|
||||
async function DownloadAllImage() {
|
||||
let da = dialog.warning({
|
||||
title: '采集所有图片提示',
|
||||
content:
|
||||
'即将开始采集所有的MJ生图图片,满足一下条件的分镜才会被采集:状态不为 error,有生图信息,有消息ID,没有生成图片,图片的有效期为24小时,是否继续?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
let res = await window.book.GetImageUrlAndDownload(
|
||||
reverseManageStore.selectBookTask.id,
|
||||
OperateBookType.BOOKTASK,
|
||||
false
|
||||
)
|
||||
if (res.code == 1) {
|
||||
// 这边要修改下数据
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
const element = res.data[i]
|
||||
let findIndex = reverseManageStore.selectBookTaskDetail.findIndex(
|
||||
(item) => item.id == element.id
|
||||
)
|
||||
if (findIndex != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].outImagePath =
|
||||
element.data.outImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].subImagePath =
|
||||
element.data.subImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].mjMessage = element.data.mjMessage
|
||||
}
|
||||
}
|
||||
message.success(res.message)
|
||||
} else {
|
||||
message.error(res.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function OneToFourBookTask() {
|
||||
dialog.warning({
|
||||
title: '一拆四提示',
|
||||
content:
|
||||
'是否一拆四(一拆四是个泛指,根据出的子图数量最少的),会自动生成多个批次任务并设置对应的图片!',
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
let res = await window.book.OneToFourBookTask(reverseManageStore.selectBookTask.id)
|
||||
if (res.code == 0) {
|
||||
message.error(res.message)
|
||||
return
|
||||
}
|
||||
message.success(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -117,7 +117,7 @@ import { ref, onMounted, defineComponent, onUnmounted, toRaw, watch } from 'vue'
|
||||
import { useMessage, NButton, NForm, NFormItem, NInput, NSelect, NIcon } from 'naive-ui'
|
||||
import { useReverseManageStore } from '../../../../../../stores/reverseManage.ts'
|
||||
import { CloseSharp } from '@vicons/ionicons5'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { cloneDeep, isEmpty } from 'lodash'
|
||||
import { useSoftwareStore } from '../../../../../../stores/software.ts'
|
||||
import { BookType } from '../../../../../../define/enum/bookEnum'
|
||||
|
||||
@@ -227,9 +227,15 @@ export default defineComponent({
|
||||
oldVideoPath: {
|
||||
required: true,
|
||||
validator(rule, value) {
|
||||
// 判断是不是原创,原创不能选择视频文件,反推必选
|
||||
if(reverseManageStore.selectBook.type == BookType.SD_REVERSE || reverseManageStore.selectBook.type == BookType.MJ_REVERSE){
|
||||
return new Error("MJ反推和SD反推,视频文件必选")
|
||||
debugger
|
||||
if (isEmpty(value)) {
|
||||
// 判断是不是原创,原创不能选择视频文件,反推必选
|
||||
if (
|
||||
reverseManageStore.selectBook.type == BookType.SD_REVERSE ||
|
||||
reverseManageStore.selectBook.type == BookType.MJ_REVERSE
|
||||
) {
|
||||
return new Error('MJ反推和SD反推,视频文件必选')
|
||||
}
|
||||
}
|
||||
},
|
||||
trigger: ['input', 'blur', 'change']
|
||||
|
||||
@@ -1,66 +1,83 @@
|
||||
<template>
|
||||
<div>
|
||||
<span style="margin-right: 5px">推理提示词</span>
|
||||
<div style="display: flex; align-items: center">
|
||||
<div>
|
||||
<span style="margin-right: 5px">推理提示词</span>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="AddPrefix"
|
||||
>通用前缀</n-button
|
||||
>
|
||||
</template>
|
||||
<span>添加通用前缀,只能添加英文,并且通用前缀不为空,推理会自动添加前缀</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="AddSuffix"
|
||||
>通用后缀</n-button
|
||||
>
|
||||
</template>
|
||||
<span>添加通用后缀,只能添加英文,并且通用后缀不为空,推理会自动添加后缀</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="SelectStyle"
|
||||
>风格</n-button
|
||||
>
|
||||
</template>
|
||||
<span>选择生成图片的风格</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<span>
|
||||
<n-dropdown trigger="hover" :options="translate_options" @select="TranslateAll">
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="TranslateAll('english')"
|
||||
>一键翻译</n-button
|
||||
>
|
||||
</n-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
<span
|
||||
>将下面的推理提示词或者是手写的提示词翻译成英文(只会翻译存在中文的数据),下面的翻译中文会将所有的推理提示词翻译为中文(全部都会翻译)</span
|
||||
>
|
||||
</n-popover>
|
||||
</div>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="AddPrefix"
|
||||
>通用前缀</n-button
|
||||
color="#7c461e"
|
||||
@click="SelectReversePromptAndReplace"
|
||||
text
|
||||
style="font-size: 24px; margin-left: 3px"
|
||||
>
|
||||
<n-icon>
|
||||
<FindReplaceRound />
|
||||
</n-icon>
|
||||
</n-button>
|
||||
</template>
|
||||
<span>添加通用前缀,只能添加英文,并且通用前缀不为空,推理会自动添加前缀</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="AddSuffix"
|
||||
>通用后缀</n-button
|
||||
>
|
||||
</template>
|
||||
<span>添加通用后缀,只能添加英文,并且通用后缀不为空,推理会自动添加后缀</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="SelectStyle"
|
||||
>风格</n-button
|
||||
>
|
||||
</template>
|
||||
<span>选择生成图片的风格</span>
|
||||
</n-popover>
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<span>
|
||||
<n-dropdown trigger="hover" :options="translate_options" @select="TranslateAll">
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ZHUYANTUO"
|
||||
style="margin-left: 5px"
|
||||
size="tiny"
|
||||
@click="TranslateAll('english')"
|
||||
>一键翻译</n-button
|
||||
>
|
||||
</n-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
<span
|
||||
>将下面的推理提示词或者是手写的提示词翻译成英文(只会翻译存在中文的数据),下面的翻译中文会将所有的推理提示词翻译为中文(全部都会翻译)</span
|
||||
>
|
||||
<span>批量替换推理提示词</span>
|
||||
</n-popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, h, toRaw } from 'vue'
|
||||
import { NPopover, NButton, NDropdown, useMessage, useDialog } from 'naive-ui'
|
||||
import { NPopover, NButton, NDropdown, useMessage, useDialog, NIcon } from 'naive-ui'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import SelectImageStyle from '../../Components/SelectImageStyle.vue'
|
||||
@@ -69,6 +86,9 @@ import { ContainsChineseOrPunctuation } from '../../../../../define/Tools/common
|
||||
import { isEmpty } from 'lodash'
|
||||
import { TranslateType } from '../../../../../define/enum/translate'
|
||||
import { DEFINE_STRING } from '../../../../../define/define_string'
|
||||
import FindReplaceRound from '../../Icon/FindReplaceRound.vue'
|
||||
import DatatableHeaderAfterGptSelectAndReplace from '../Components/DatatableHeaderAfterGptSelectAndReplace.vue'
|
||||
import { BookRepalceDataType } from '../../../../../define/enum/bookEnum'
|
||||
|
||||
let softwareStore = useSoftwareStore()
|
||||
let reverseManageStore = useReverseManageStore()
|
||||
@@ -288,4 +308,15 @@ async function SelectStyle() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
async function SelectReversePromptAndReplace() {
|
||||
dialog.create({
|
||||
title: '批量查询替换反推提示词',
|
||||
showIcon: false,
|
||||
maskClosable: false,
|
||||
content: () =>
|
||||
h(DatatableHeaderAfterGptSelectAndReplace, { type: BookRepalceDataType.GPT_PROMPT })
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<div style="display: flex">
|
||||
<span style="margin-right: 5px">提示词命令</span>
|
||||
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
@@ -33,6 +32,22 @@
|
||||
@click="MJBadPromptCheck"
|
||||
>敏感词检查</n-button
|
||||
>
|
||||
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
color="#7c461e"
|
||||
@click="SelectPromptAndReplace"
|
||||
text
|
||||
style="font-size: 24px; margin-left: 10px"
|
||||
>
|
||||
<n-icon>
|
||||
<FindReplaceRound />
|
||||
</n-icon>
|
||||
</n-button>
|
||||
</template>
|
||||
<span>批量查询替换文案</span>
|
||||
</n-popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -43,7 +58,9 @@ import { Construct } from '@vicons/ionicons5'
|
||||
import DynamicTagsSelect from '../../Components/DynamicTagsSelect.vue'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import { OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
import { BookRepalceDataType, OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
import FindReplaceRound from '../../Icon/FindReplaceRound.vue'
|
||||
import DatatableHeaderAfterGptSelectAndReplace from '../Components/DatatableHeaderAfterGptSelectAndReplace.vue'
|
||||
let message = useMessage()
|
||||
let dialog = useDialog()
|
||||
let softwareStore = useSoftwareStore()
|
||||
@@ -118,7 +135,7 @@ async function MergePrompt(type = null) {
|
||||
} else if (image_generate_category == 'mj') {
|
||||
mergeType = 'mj_merge'
|
||||
} else if (image_generate_category == 'd3') {
|
||||
message.error('D3模式不支持')
|
||||
mergeType = 'sd_merge'
|
||||
} else if (image_generate_category == 'flux-api' || image_generate_category == 'flux-forge') {
|
||||
mergeType = 'sd_merge'
|
||||
} else {
|
||||
@@ -167,4 +184,13 @@ async function MergePromptSelect(key) {
|
||||
async function MJBadPromptCheck() {
|
||||
message.error('敏感词检测功能暂未开放')
|
||||
}
|
||||
|
||||
async function SelectPromptAndReplace() {
|
||||
dialog.create({
|
||||
title: '批量查询替换生图提示词',
|
||||
showIcon: false,
|
||||
maskClosable: false,
|
||||
content: () => h(DatatableHeaderAfterGptSelectAndReplace, { type: BookRepalceDataType.PROMPT })
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
:color="softwareStore.SoftColor.BROWN_YELLOW"
|
||||
style="margin-right: 5px"
|
||||
size="tiny"
|
||||
@click="ImportMJImageUrl"
|
||||
@click="ImportImageUrl"
|
||||
>导入图片</n-button
|
||||
>
|
||||
</template>
|
||||
@@ -47,10 +47,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { NButton, NInput, NPopover, useMessage } from 'naive-ui'
|
||||
import { ref, h } from 'vue'
|
||||
import { NButton, NInput, NPopover, useMessage, useDialog } from 'naive-ui'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import InputDialogContent from '../../Original/Components/InputDialogContent.vue'
|
||||
import {
|
||||
BookBackTaskType,
|
||||
BookImageCategory,
|
||||
@@ -66,7 +67,8 @@ let props = defineProps({
|
||||
let softwareStore = useSoftwareStore()
|
||||
let reverseManageStore = useReverseManageStore()
|
||||
let message = useMessage()
|
||||
|
||||
let dialog = useDialog()
|
||||
let image_url_ref = ref(null)
|
||||
let row = ref(props.initData)
|
||||
|
||||
let InputDebounced = debounce(handleInput, 500)
|
||||
@@ -89,7 +91,7 @@ async function SingleMergePrompt() {
|
||||
} else if (image_generate_category == 'mj') {
|
||||
mergeType = 'mj_merge'
|
||||
} else if (image_generate_category == 'd3') {
|
||||
message.error('D3模式不支持')
|
||||
mergeType = 'sd_merge'
|
||||
} else if (image_generate_category == 'flux-api' || image_generate_category == 'flux-forge') {
|
||||
mergeType = 'sd_merge'
|
||||
} else {
|
||||
@@ -262,4 +264,44 @@ async function NextGenerateImage() {
|
||||
message.error(res.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function ImportImageUrl() {
|
||||
// 判断当前数据是不是存在
|
||||
// 处理数据。获取当前的所有的数据
|
||||
let dialogWidth = 400
|
||||
let dialogHeight = 150
|
||||
dialog.create({
|
||||
title: '添加图片链接/本地地址',
|
||||
showIcon: false,
|
||||
closeOnEsc: false,
|
||||
content: () =>
|
||||
h(InputDialogContent, {
|
||||
ref: image_url_ref,
|
||||
initData: null,
|
||||
placeholder: '请输入图片链接/本地地址'
|
||||
}),
|
||||
style: `width : ${dialogWidth}px; min-height : ${dialogHeight}px`,
|
||||
maskClosable: false,
|
||||
onClose: async () => {
|
||||
let row_image_url = image_url_ref.value.data
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在下载图片/分割图片中。。。'
|
||||
let res = await window.book.DownloadImageUrlAndSplit(row.value.id, row_image_url)
|
||||
softwareStore.spin.spinning = false
|
||||
if (res.code == 0) {
|
||||
message.error(res.message)
|
||||
return
|
||||
}
|
||||
let findIndex = reverseManageStore.selectBookTaskDetail.findIndex(
|
||||
(item) => item.id == row.value.id
|
||||
)
|
||||
if (findIndex != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].outImagePath = res.data.outImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].subImagePath = res.data.subImagePath
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].mjMessage = res.data.mjMessage
|
||||
}
|
||||
message.success(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -77,6 +77,7 @@ import {
|
||||
} from '../../../../../define/enum/bookEnum'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { DEFINE_STRING } from '../../../../../define/define_string'
|
||||
import { isEmpty } from 'lodash'
|
||||
let softwareStore = useSoftwareStore()
|
||||
let reverseManageStore = useReverseManageStore()
|
||||
let dialog = useDialog()
|
||||
@@ -92,8 +93,8 @@ let GenerateImageOptions = ref([
|
||||
{ label: '停止生成图片任务', key: 'stop_generate_image' }
|
||||
])
|
||||
let ResetDataOptions = ref([
|
||||
{ label: '重置GPT提示词', key: 'reset_gpt_prompt' },
|
||||
{ label: '重置提示词', key: 'reset_prompt' },
|
||||
{ label: '重置GPT提示词', key: 'reset_prompt' },
|
||||
{ label: '重置提示词', key: 'reset_merge_prompt' },
|
||||
{ label: '重置图片', key: 'reset_image' }
|
||||
])
|
||||
|
||||
@@ -246,6 +247,39 @@ async function ResetGPTPrompt() {
|
||||
})
|
||||
}
|
||||
|
||||
// 重置所有的合并提示词数据
|
||||
async function ResetMergePrompt() {
|
||||
let da = dialog.warning({
|
||||
title: '重置合并提示词提示',
|
||||
content: '执行该操作会删除所有的合并提示词,并且此操作不可逆,是否继续?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在重置推理提示词,请稍后。。。'
|
||||
for (let i = 0; i < reverseManageStore.selectBookTaskDetail.length; i++) {
|
||||
const element = reverseManageStore.selectBookTaskDetail[i]
|
||||
let res = await window.db.UpdateBookTaskDetailData(element.id, {
|
||||
prompt: ''
|
||||
})
|
||||
if (res.code == 1) {
|
||||
let findIndex = reverseManageStore.selectBookTaskDetail.findIndex(
|
||||
(item) => item.id == element.id
|
||||
)
|
||||
if (findIndex != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].prompt = ''
|
||||
}
|
||||
} else {
|
||||
message.error(res.message)
|
||||
}
|
||||
}
|
||||
softwareStore.spin.spinning = false
|
||||
message.success('重置提示词数据成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 重置所有的生成图片信息
|
||||
async function ResetImage() {
|
||||
message.info('ResetImage')
|
||||
@@ -295,6 +329,9 @@ async function ButtonSelect(key) {
|
||||
} else if (key == 'generate_space_image') {
|
||||
// 生成未出图分镜
|
||||
await GenerateImageAll(false)
|
||||
} else if (key == 'reset_merge_prompt') {
|
||||
// 重置合并提示词
|
||||
await ResetMergePrompt()
|
||||
} else if (key == 'reset_image') {
|
||||
await ResetImage()
|
||||
} else {
|
||||
@@ -454,47 +491,44 @@ async function OpenPromptSetting() {
|
||||
|
||||
// 导入提示词
|
||||
async function ImportPrompt() {
|
||||
message.error('导入提示词该方法暂未实现')
|
||||
return
|
||||
// 弹窗选择文件
|
||||
window.api.SelectFile(['txt'], async (value) => {
|
||||
if (value.code == 0) {
|
||||
message.error(value.message)
|
||||
return
|
||||
}
|
||||
// 拿到提示词文件地址,然后还是获取
|
||||
await window.pmpt.OpenPromptFileTxt(value.value, (res) => {
|
||||
debugger
|
||||
console.log(res)
|
||||
if (res.code == 0) {
|
||||
message.error(res.message)
|
||||
return
|
||||
}
|
||||
// 修改数据
|
||||
// 判断获取的数据是不是小于当前的data的行
|
||||
if (res.data.length > data.value.length) {
|
||||
dialog.warning({
|
||||
title: '提示',
|
||||
content: '导入的数据行数大于当前的数据行数,多余的数据会被删除,是否继续导入?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
debugger
|
||||
// 开始导入
|
||||
for (let i = 0; i < data.value.length && i < res.data.length; i++) {
|
||||
const element = res.data[i]
|
||||
// 开始修改
|
||||
data.value[i].gpt_prompt = element
|
||||
if (isEmpty(value.value)) {
|
||||
message.error('返回的文件地址为空')
|
||||
return
|
||||
}
|
||||
|
||||
let da = dialog.warning({
|
||||
title: '导入提示词提示',
|
||||
content: `即将开始导入提示词,务必保证提示词文件的行数和分镜的行数相同,否则可能会导致数据丢失,当前的导入的文件地址为 ${value.value},是否继续?`,
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
da?.destroy()
|
||||
softwareStore.spin.spinning = true
|
||||
softwareStore.spin.tip = '正在导入提示词数据中。。。'
|
||||
let res = await window.book.ImportGPTPrompt(
|
||||
reverseManageStore.selectBookTask.id,
|
||||
value.value
|
||||
)
|
||||
softwareStore.spin.spinning = false
|
||||
if (res.code == 1) {
|
||||
// 这边还要修改下前端界面
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
const element = res.data[i]
|
||||
let findIndex = reverseManageStore.selectBookTaskDetail.findIndex(
|
||||
(item) => item.id == element.id
|
||||
)
|
||||
if (findIndex != -1) {
|
||||
reverseManageStore.selectBookTaskDetail[findIndex].gptPrompt = element.gptPrompt
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 开始导入
|
||||
for (let i = 0; i < data.value.length && i < res.data.length; i++) {
|
||||
const element = res.data[i]
|
||||
// 开始修改
|
||||
data.value[i].gpt_prompt = element
|
||||
}
|
||||
window.api.showGlobalMessage(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -107,6 +107,7 @@ const createColumns = ({}) => {
|
||||
className: 'empty-margin',
|
||||
fixed: 'left',
|
||||
render(row, index) {
|
||||
console.log('row', row, index)
|
||||
return h(DatatableAfterGpt, { initData: row, index: index })
|
||||
}
|
||||
},
|
||||
@@ -133,7 +134,7 @@ const createColumns = ({}) => {
|
||||
resizable: true,
|
||||
minWidth: 330,
|
||||
maxWidth: 700,
|
||||
width: '350',
|
||||
width: '360',
|
||||
render(row, index) {
|
||||
return h(ODataTableGptPrompt, { initData: row, index: index })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user