Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
text2video-frontend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周成波
text2video-frontend
Commits
fc8e8456
Commit
fc8e8456
authored
Feb 20, 2024
by
周成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加英文界面
parent
aac7852c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
519 additions
and
59 deletions
+519
-59
.gitignore
.gitignore
+1
-0
components.d.ts
components.d.ts
+0
-9
index.ts
src/router/index.ts
+6
-0
utils.ts
src/utils/utils.ts
+11
-0
useManyValues.ts
src/views/home/compositions/useManyValues.ts
+80
-46
index.vue
src/views/home/index.vue
+3
-3
index_en.vue
src/views/home/index_en.vue
+417
-0
vite.config.ts
vite.config.ts
+1
-1
No files found.
.gitignore
View file @
fc8e8456
...
@@ -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/
...
...
components.d.ts
View file @
fc8e8456
...
@@ -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'
]
...
...
src/router/index.ts
View file @
fc8e8456
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
}
}
]
]
})
})
...
...
src/utils/utils.ts
View file @
fc8e8456
...
@@ -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
}
}
}
src/views/home/compositions/useManyValues.ts
View file @
fc8e8456
This diff is collapsed.
Click to expand it.
src/views/home/index.vue
View file @
fc8e8456
...
@@ -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
,
''
);
...
...
src/views/home/index_en.vue
0 → 100644
View file @
fc8e8456
This diff is collapsed.
Click to expand it.
vite.config.ts
View file @
fc8e8456
...
@@ -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
:
952
8
,
port
:
952
9
,
https
:
false
,
https
:
false
,
}
}
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment