LaiTool 3.0.1
This commit is contained in:
+2
-2
@@ -115,10 +115,10 @@
|
||||
<script>
|
||||
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 { useReverseManageStore } from '../../../../../../stores/reverseManage.ts'
|
||||
import { CloseSharp } from '@vicons/ionicons5'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useSoftwareStore } from '../../../../../../stores/software.ts'
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
+3
-3
@@ -30,9 +30,9 @@
|
||||
<script setup>
|
||||
import { ref, h, toRaw } from 'vue'
|
||||
import { useMessage, useDialog, NButton } from 'naive-ui'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage.ts'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import AddBook from '../Components/AddBook.vue'
|
||||
import { useReverseManageStore } from '../../../../../../stores/reverseManage.ts'
|
||||
import { useSoftwareStore } from '../../../../../../stores/software.ts'
|
||||
import AddBook from './AddBook.vue'
|
||||
let props = defineProps({
|
||||
book: undefined
|
||||
})
|
||||
+3
-3
@@ -36,9 +36,9 @@
|
||||
<script>
|
||||
import { ref, onMounted, defineComponent, h } from 'vue'
|
||||
import { useMessage, NButton, useDialog } from 'naive-ui'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage.ts'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { BookType, OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
import { useReverseManageStore } from '../../../../../../stores/reverseManage.ts'
|
||||
import { useSoftwareStore } from '../../../../../../stores/software.ts'
|
||||
import { BookType, OperateBookType } from '../../../../../../define/enum/bookEnum.ts'
|
||||
import ManageBookTaskGenerateInformation from './ManageBookTaskGenerateInformation.vue'
|
||||
|
||||
export default defineComponent({
|
||||
+4
-4
@@ -41,10 +41,10 @@
|
||||
import { ref, onMounted, defineComponent, onUnmounted, h, toRaw, computed } from 'vue'
|
||||
import { useMessage, NButton, NIcon, useDialog, NPopover, NSwitch, NDropdown } from 'naive-ui'
|
||||
import { AddSharp, ReloadSharp, ResizeSharp, SwapHorizontalSharp } from '@vicons/ionicons5'
|
||||
import AddBook from '../Components/AddBook.vue'
|
||||
import { useSoftwareStore } from '../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage.ts'
|
||||
import { BookType } from '../../../../../define/enum/bookEnum'
|
||||
import AddBook from './AddBook.vue'
|
||||
import { useSoftwareStore } from '../../../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../../../stores/reverseManage'
|
||||
import { BookType } from '../../../../../../define/enum/bookEnum'
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
+3
-3
@@ -14,9 +14,9 @@
|
||||
<script>
|
||||
import { ref, onMounted, defineComponent, onUnmounted, toRaw, nextTick, watchEffect } from 'vue'
|
||||
import { useMessage, NLog } from 'naive-ui'
|
||||
import Artplayer from '../../Components/Artplayer.vue'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage.ts'
|
||||
import { DEFINE_STRING } from '../../../../../define/define_string'
|
||||
import Artplayer from '../../../Components/Artplayer.vue'
|
||||
import { useReverseManageStore } from '../../../../../../stores/reverseManage.ts'
|
||||
import { DEFINE_STRING } from '../../../../../../define/define_string.ts'
|
||||
|
||||
export default defineComponent({
|
||||
components: { Artplayer, NLog },
|
||||
+1
-1
@@ -66,7 +66,7 @@
|
||||
import { ref, onMounted, defineComponent, onUnmounted, toRaw, watch } from 'vue'
|
||||
import { useMessage, NForm, NFormItem, NButton, NIcon, NInput, NSelect } from 'naive-ui'
|
||||
import { FolderOpen } from '@vicons/ionicons5'
|
||||
import { OperateBookType } from '../../../../../define/enum/bookEnum'
|
||||
import { OperateBookType } from '../../../../../../define/enum/bookEnum'
|
||||
|
||||
export default defineComponent({
|
||||
components: { NForm, NFormItem, NButton, NIcon, NInput, NSelect, FolderOpen },
|
||||
@@ -15,9 +15,9 @@
|
||||
<n-button
|
||||
:color="softwareStore.SoftColor.ORANGE"
|
||||
style="margin-left: 5px"
|
||||
@click="GetCopywriting"
|
||||
@click="GetCopywriting('all')"
|
||||
>
|
||||
开始提取文案
|
||||
开始提取全部文案
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
|
||||
@@ -244,7 +244,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
// 获取文案信息
|
||||
async function GetCopywriting() {
|
||||
async function GetCopywriting(type) {
|
||||
if (isEmpty(reverseManageStore.selectBookTask.id)) {
|
||||
window.api.showGlobalMessageDialog({
|
||||
code: 0,
|
||||
@@ -261,7 +261,9 @@ export default defineComponent({
|
||||
|
||||
let da = dialog.warning({
|
||||
title: '开始提取文案提示',
|
||||
content: `即将进行文案提取,当前的文案提取模式为 ${subtitleSettingRes.data.selectModel} ,是否继续?`,
|
||||
content: `即将进行 ${type == 'blank' ? '空白' : '全部'} 文案提取${
|
||||
type == 'blank' ? '' : ',会重新提取并覆盖旧的文案数据'
|
||||
},当前的文案提取模式为 ${subtitleSettingRes.data.selectModel} ,是否继续?`,
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
@@ -271,7 +273,8 @@ export default defineComponent({
|
||||
let copywriting_res = await window.book.GetCopywriting(
|
||||
reverseManageStore.selectBook.id,
|
||||
reverseManageStore.selectBookTask.id,
|
||||
OperateBookType.BOOKTASK
|
||||
OperateBookType.BOOKTASK,
|
||||
type == 'blank' ? false : true
|
||||
)
|
||||
softwareStore.spin.spinning = false
|
||||
if (copywriting_res.code == 0) {
|
||||
@@ -382,6 +385,9 @@ export default defineComponent({
|
||||
case 'framing': // 开始分镜
|
||||
await Framing()
|
||||
break
|
||||
case 'recognizing_blank': // 提取空白文案
|
||||
await GetCopywriting('blank')
|
||||
break
|
||||
case 'recognizing_setting': // 文案位置设置
|
||||
await GetCopywritingSetting()
|
||||
break
|
||||
@@ -561,30 +567,41 @@ export default defineComponent({
|
||||
* @param to 目标语言
|
||||
*/
|
||||
async function TranslateService(from, to) {
|
||||
debugger
|
||||
let translateData = []
|
||||
for (let i = 0; i < reverseManageStore.selectBookTaskDetail.length; i++) {
|
||||
const element = reverseManageStore.selectBookTaskDetail[i]
|
||||
let reversePrompt = element.reversePrompt
|
||||
if (reversePrompt) {
|
||||
reversePrompt.forEach((item) => {
|
||||
if (from == 'zh' && to == 'en') {
|
||||
// 判断是不是有中文
|
||||
if (!ContainsChineseOrPunctuation(item.promptCN ? item.promptCN : item.prompt)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let temp_obj = {
|
||||
text: item.prompt,
|
||||
from: from,
|
||||
to: to,
|
||||
type: TranslateType.REVERSE_PROMPT_TRANSLATE,
|
||||
isSplit: false, // 该参数设置为true时,会将文本按照标点符号分割成多个句子进行翻译
|
||||
bookTaskDetailId: element.id,
|
||||
reversePromptId: item.id
|
||||
}
|
||||
translateData.push(temp_obj)
|
||||
if (!isEmpty(element.gptPrompt)) {
|
||||
translateData.push({
|
||||
text: element.gptPrompt,
|
||||
from: from,
|
||||
to: to,
|
||||
type: TranslateType.GPT_PROMPT_TRANSLATE,
|
||||
isSplit: false, // 该参数设置为true时,会将文本按照标点符号分割成多个句子进行翻译
|
||||
bookTaskDetailId: element.id
|
||||
})
|
||||
} else {
|
||||
let reversePrompt = element.reversePrompt
|
||||
if (reversePrompt) {
|
||||
reversePrompt.forEach((item) => {
|
||||
if (from == 'zh' && to == 'en') {
|
||||
// 判断是不是有中文
|
||||
if (!ContainsChineseOrPunctuation(item.promptCN ? item.promptCN : item.prompt)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
let temp_obj = {
|
||||
text: item.promptCN ? item.promptCN : item.prompt,
|
||||
from: from,
|
||||
to: to,
|
||||
type: TranslateType.REVERSE_PROMPT_TRANSLATE,
|
||||
isSplit: false, // 该参数设置为true时,会将文本按照标点符号分割成多个句子进行翻译
|
||||
bookTaskDetailId: element.id,
|
||||
reversePromptId: item.id
|
||||
}
|
||||
translateData.push(temp_obj)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if (translateData.length == 0) {
|
||||
@@ -704,6 +721,10 @@ export default defineComponent({
|
||||
{ label: '分镜', key: 'framing' }
|
||||
],
|
||||
copywritingOptions: [
|
||||
{
|
||||
label: '提取空白文案',
|
||||
key: 'recognizing_blank'
|
||||
},
|
||||
{
|
||||
label: '提取文案位置',
|
||||
key: 'recognizing_setting'
|
||||
|
||||
@@ -71,7 +71,8 @@ async function GetVideoSubtitle() {
|
||||
let res = await window.book.GetCopywriting(
|
||||
reverseManageStore.selectBook.id,
|
||||
data.value.id,
|
||||
OperateBookType.BOOKTASKDETAIL
|
||||
OperateBookType.BOOKTASKDETAIL,
|
||||
true
|
||||
)
|
||||
softwareStore.spin.spinning = false
|
||||
if (res.code == 0) {
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
<script>
|
||||
import { ref, onMounted, defineComponent, onUnmounted, toRaw, reactive, computed, h } from 'vue'
|
||||
import { useMessage, NButton, NDataTable, NTag, NEllipsis } from 'naive-ui'
|
||||
import ManageBookButton from './Components/ManageBookButton.vue'
|
||||
import ManageBookButton from './Components/ManageBook/ManageBookButton.vue'
|
||||
import { useSoftwareStore } from '../../../../stores/software'
|
||||
import { useReverseManageStore } from '../../../../stores/reverseManage.ts'
|
||||
import { BookType } from '../../../../define/enum/bookEnum'
|
||||
import BookListAction from './Components/BookListAction.vue'
|
||||
import BookListAction from './Components/ManageBook/BookListAction.vue'
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ref, onMounted, defineComponent, onUnmounted, toRaw, watch } from 'vue'
|
||||
import { useMessage, NDivider } from 'naive-ui'
|
||||
import ManageBookDetailButton from './Components/ManageBookDetailButton.vue'
|
||||
import ManageBookReverseTable from './MJReverse/ManageBookReverseTable.vue'
|
||||
import ManageBookShowLogger from './Components/ManageBookShowLogger.vue'
|
||||
import ManageBookShowLogger from './Components/ManageBook/ManageBookShowLogger.vue'
|
||||
import { useSoftwareStore } from '../../../../stores/software'
|
||||
import { DEFINE_STRING } from '../../../../define/define_string'
|
||||
import { DialogType } from '../../../../define/enum/bookEnum'
|
||||
|
||||
@@ -36,7 +36,7 @@ import { useMessage, useDialog, NButton, NDataTable, NIcon, NWatermark } from 'n
|
||||
import { useReverseManageStore } from '../../../../stores/reverseManage'
|
||||
import { useSoftwareStore } from '../../../../stores/software'
|
||||
import { AddSharp } from '@vicons/ionicons5'
|
||||
import BookTaskListAction from './Components/BookTaskListAction.vue'
|
||||
import BookTaskListAction from './Components/ManageBook/BookTaskListAction.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { OperateBookType } from '../../../../define/enum/bookEnum'
|
||||
import { DEFINE_STRING } from '../../../../define/define_string'
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<n-button
|
||||
text
|
||||
:type="data.imageLock ? 'error' : 'primary'"
|
||||
style="font-size: 24px; position: absolute; left: -12px; top: -0"
|
||||
style="font-size: 24px; position: absolute; left: -12px; top: -5px"
|
||||
@click="ModifyLock"
|
||||
>
|
||||
<n-icon>
|
||||
@@ -96,6 +96,16 @@
|
||||
<LockOpen v-else />
|
||||
</n-icon>
|
||||
</n-button>
|
||||
<n-button
|
||||
text
|
||||
type="info"
|
||||
style="font-size: 24px; position: absolute; left: 8px; top: -5px"
|
||||
@click="DownloadImage"
|
||||
>
|
||||
<n-icon>
|
||||
<Download />
|
||||
</n-icon>
|
||||
</n-button>
|
||||
</div>
|
||||
<div>
|
||||
<n-divider vertical style="height: 100%" />
|
||||
@@ -128,6 +138,7 @@ import { ref, h, onMounted, defineComponent, onUnmounted, toRaw, watch } from 'v
|
||||
import {
|
||||
NImage,
|
||||
useMessage,
|
||||
useDialog,
|
||||
NDivider,
|
||||
NImageGroup,
|
||||
NButton,
|
||||
@@ -138,8 +149,9 @@ import {
|
||||
} from 'naive-ui'
|
||||
import { usePromptStore } from '../../../../../stores/prompt'
|
||||
import { useImageStore } from '../../../../../stores/image'
|
||||
import { LockClosed, LockOpen } from '@vicons/ionicons5'
|
||||
import { LockClosed, LockOpen, Download } from '@vicons/ionicons5'
|
||||
import { useReverseManageStore } from '../../../../../stores/reverseManage'
|
||||
import { isEmpty } from 'lodash'
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -152,13 +164,15 @@ export default defineComponent({
|
||||
NTag,
|
||||
NIcon,
|
||||
LockClosed,
|
||||
LockOpen
|
||||
LockOpen,
|
||||
Download
|
||||
},
|
||||
props: ['initData', 'type', 'image_generate_category', 'func', 'index'],
|
||||
setup(props) {
|
||||
let imageStore = useImageStore()
|
||||
let promptStore = usePromptStore()
|
||||
let message = useMessage()
|
||||
let dialog = useDialog()
|
||||
let data = ref(props.initData)
|
||||
let type = ref(props.type)
|
||||
let images = ref(props.initData.subImagePath)
|
||||
@@ -313,7 +327,16 @@ export default defineComponent({
|
||||
* MJ采集图片
|
||||
*/
|
||||
async function MJGetImage() {
|
||||
props.func.mJGetImage()
|
||||
dialog.warning({
|
||||
title: 'MJ采集图片警告',
|
||||
content:
|
||||
'只有API出图才能采集,其他模式不支持,且API出图图片链接一般只有二十四个小时有效,过期失败,是否继续?',
|
||||
positiveText: '继续',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await props.func.mJGetImage()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,12 +374,70 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载对应的分镜图片
|
||||
*/
|
||||
async function DownloadImage() {
|
||||
// 目前只能判断是不是有mj_message
|
||||
dialog.warning({
|
||||
title: '下载图片警告',
|
||||
content: '单个图片的下载,只支持 MJ API 生图,当前有图片的话会被覆盖掉,是否继续?',
|
||||
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('暂时不支持')
|
||||
return
|
||||
} else {
|
||||
message.error('没有生图数据')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
type,
|
||||
image_options,
|
||||
sd_batch_size,
|
||||
ModifyLock,
|
||||
DownloadImage,
|
||||
width,
|
||||
images,
|
||||
space_image,
|
||||
|
||||
@@ -933,12 +933,26 @@ export default defineComponent({
|
||||
if (!item.mj_message) {
|
||||
continue
|
||||
}
|
||||
if (item.mj_message.status && item.mj_message.status == 'error') {
|
||||
// 只要状态不是success 和 error ,其他的都重新获取
|
||||
if (item.mj_message.status == 'error' || item.mj_message.status == 'success') {
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断message_id是不是有值,有值重新抓
|
||||
|
||||
if (item.mj_message.message_id && !isEmpty(item.mj_message.message_id)) {
|
||||
pa.push(item)
|
||||
}
|
||||
|
||||
// // 判断是不是又图片,没有的话,重新抓
|
||||
// if (
|
||||
// !(isEmpty(item.outImagePath) || (!item.subImagePath && item.subImagePath.length <= 0))
|
||||
// ) {
|
||||
// continue
|
||||
// }
|
||||
// if (item.mj_message.message_id && !isEmpty(item.mj_message.message_id)) {
|
||||
// pa.push(item)
|
||||
// }
|
||||
}
|
||||
|
||||
if (pa.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user