Commit fc8e8456 authored by 周成波's avatar 周成波

增加英文界面

parent aac7852c
...@@ -14,6 +14,7 @@ dist-ssr ...@@ -14,6 +14,7 @@ dist-ssr
coverage coverage
*.local *.local
dist.* dist.*
dist-bak*
/cypress/videos/ /cypress/videos/
/cypress/screenshots/ /cypress/screenshots/
......
...@@ -8,24 +8,15 @@ export {} ...@@ -8,24 +8,15 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDivider: typeof import('element-plus/es')['ElDivider'] ElDivider: typeof import('element-plus/es')['ElDivider']
ElElFormItem: typeof import('element-plus/es')['ElElFormItem']
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage'] ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']
ElUpload: typeof import('element-plus/es')['ElUpload']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default'] IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default'] IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
......
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/index.vue' import HomeView from '../views/home/index.vue'
import HomeViewEn from '../views/home/index_en.vue'
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL), history: createWebHashHistory(import.meta.env.BASE_URL),
...@@ -8,6 +9,11 @@ const router = createRouter({ ...@@ -8,6 +9,11 @@ const router = createRouter({
path: '/', path: '/',
name: 'home', name: 'home',
component: HomeView component: HomeView
},
{
path: '/en',
name: 'home_en',
component: HomeViewEn
} }
] ]
}) })
......
...@@ -43,4 +43,15 @@ export default class utils { ...@@ -43,4 +43,15 @@ export default class utils {
return sentences return sentences
} }
// 拆分英文文本
static splitTextEn(str: string) {
str = str.replaceAll('"','').replaceAll('"','')
// 使用正则表达式拆分文本
let sentences = str.split(/[!|?|.]/);
// 过滤掉长度为 0 的句子
sentences = sentences.filter(s => s.length > 0);
// console.log(sentences)
return sentences
}
} }
...@@ -64,7 +64,7 @@ const onAdaptRoles = async () => { ...@@ -64,7 +64,7 @@ const onAdaptRoles = async () => {
严格以如下格式返回:[{"角色":"","角色关键词":""}]`; 严格以如下格式返回:[{"角色":"","角色关键词":""}]`;
const keywords = await text2videoService.submitGpt(form.chatgpt_answer + "\n" + adapt_restrict); const keywords = await text2videoService.submitGpt(form.chatgpt_answer + "\n" + adapt_restrict);
console.log(keywords) console.log(keywords)
const keywords_obj = utils.formatJsonObj(keywords) const keywords_obj = utils.formatJsonObj(keywords.replace(/```json/g, '').replace(/```/g, ''))
console.log(keywords_obj) console.log(keywords_obj)
form.chatgpt_answer_roles = [] form.chatgpt_answer_roles = []
for (let item of keywords_obj) { for (let item of keywords_obj) {
...@@ -121,8 +121,8 @@ const onAdapt = async () => { ...@@ -121,8 +121,8 @@ const onAdapt = async () => {
async function processScenes() { async function processScenes() {
for (const item of form.adapt_result_json) { for (const item of form.adapt_result_json) {
await onAdaptOne(item); await onAdaptOne(item);
await onDrawOne(item);
await delay(1000); await delay(1000);
await onDrawOne(item);
} }
} }
...@@ -165,7 +165,7 @@ const onAdaptOne = async (item: any) => { ...@@ -165,7 +165,7 @@ const onAdaptOne = async (item: any) => {
严格以如下格式返回:[{"场景关键词":"(多个词以逗号分隔)","角色":"(角色以逗号分隔)","角色关键词":"(分别给予对应角色的关键词,多个词以逗号分隔)"}]`; 严格以如下格式返回:[{"场景关键词":"(多个词以逗号分隔)","角色":"(角色以逗号分隔)","角色关键词":"(分别给予对应角色的关键词,多个词以逗号分隔)"}]`;
const keywords = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n所有角色:\n"+ JSON.stringify(form.chatgpt_answer_roles)+"\n" + adapt_restrict); const keywords = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n所有角色:\n"+ JSON.stringify(form.chatgpt_answer_roles)+"\n" + adapt_restrict);
// console.log(keywords) // console.log(keywords)
const keywords_obj = utils.formatJsonObj(keywords) const keywords_obj = utils.formatJsonObj(keywords.replace(/```json/g, '').replace(/```/g, ''))
// console.log(keywords_obj) // console.log(keywords_obj)
item.场景关键词 = JSON.stringify(keywords_obj[0].场景关键词).replace(/"/g, ''); item.场景关键词 = JSON.stringify(keywords_obj[0].场景关键词).replace(/"/g, '');
item.角色 = JSON.stringify(keywords_obj[0].角色).replace(/"/g, ''); item.角色 = JSON.stringify(keywords_obj[0].角色).replace(/"/g, '');
......
This diff is collapsed.
...@@ -32,7 +32,7 @@ export default defineConfig({ ...@@ -32,7 +32,7 @@ export default defineConfig({
} }
}, },
host: '0.0.0.0', host: '0.0.0.0',
port: 9528, port: 9529,
https: false, https: false,
} }
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment