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
1 year ago
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
coverage
*.local
dist.*
dist-bak*
/cypress/videos/
/cypress/screenshots/
...
...
This diff is collapsed.
Click to expand it.
components.d.ts
View file @
fc8e8456
...
...
@@ -8,24 +8,15 @@ export {}
declare
module
'vue'
{
export
interface
GlobalComponents
{
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'
]
ElElFormItem
:
typeof
import
(
'element-plus/es'
)[
'ElElFormItem'
]
ElForm
:
typeof
import
(
'element-plus/es'
)[
'ElForm'
]
ElFormItem
:
typeof
import
(
'element-plus/es'
)[
'ElFormItem'
]
ElIcon
:
typeof
import
(
'element-plus/es'
)[
'ElIcon'
]
ElImage
:
typeof
import
(
'element-plus/es'
)[
'ElImage'
]
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
ElRadio
:
typeof
import
(
'element-plus/es'
)[
'ElRadio'
]
ElRadioButton
:
typeof
import
(
'element-plus/es'
)[
'ElRadioButton'
]
ElRadioGroup
:
typeof
import
(
'element-plus/es'
)[
'ElRadioGroup'
]
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
ElTable
:
typeof
import
(
'element-plus/es'
)[
'ElTable'
]
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'
]
IconCommunity
:
typeof
import
(
'./src/components/icons/IconCommunity.vue'
)[
'default'
]
IconDocumentation
:
typeof
import
(
'./src/components/icons/IconDocumentation.vue'
)[
'default'
]
...
...
This diff is collapsed.
Click to expand it.
src/router/index.ts
View file @
fc8e8456
import
{
createRouter
,
createWebHashHistory
}
from
'vue-router'
import
HomeView
from
'../views/home/index.vue'
import
HomeViewEn
from
'../views/home/index_en.vue'
const
router
=
createRouter
({
history
:
createWebHashHistory
(
import
.
meta
.
env
.
BASE_URL
),
...
...
@@ -8,6 +9,11 @@ const router = createRouter({
path
:
'/'
,
name
:
'home'
,
component
:
HomeView
},
{
path
:
'/en'
,
name
:
'home_en'
,
component
:
HomeViewEn
}
]
})
...
...
This diff is collapsed.
Click to expand it.
src/utils/utils.ts
View file @
fc8e8456
...
...
@@ -43,4 +43,15 @@ export default class utils {
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
}
}
This diff is collapsed.
Click to expand it.
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 () => {
严格以如下格式返回:[{"角色":"","角色关键词":""}]`
;
const
keywords
=
await
text2videoService
.
submitGpt
(
form
.
chatgpt_answer
+
"
\n
"
+
adapt_restrict
);
console
.
log
(
keywords
)
const
keywords_obj
=
utils
.
formatJsonObj
(
keywords
)
const
keywords_obj
=
utils
.
formatJsonObj
(
keywords
.
replace
(
/```json/g
,
''
).
replace
(
/```/g
,
''
)
)
console
.
log
(
keywords_obj
)
form
.
chatgpt_answer_roles
=
[]
for
(
let
item
of
keywords_obj
)
{
...
...
@@ -121,8 +121,8 @@ const onAdapt = async () => {
async
function
processScenes
()
{
for
(
const
item
of
form
.
adapt_result_json
)
{
await
onAdaptOne
(
item
);
await
onDrawOne
(
item
);
await
delay
(
1000
);
await
onDrawOne
(
item
);
}
}
...
...
@@ -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
);
// console.log(keywords)
const
keywords_obj
=
utils
.
formatJsonObj
(
keywords
)
const
keywords_obj
=
utils
.
formatJsonObj
(
keywords
.
replace
(
/```json/g
,
''
).
replace
(
/```/g
,
''
)
)
// console.log(keywords_obj)
item
.
场景关键词
=
JSON
.
stringify
(
keywords_obj
[
0
].
场景关键词
).
replace
(
/"/g
,
''
);
item
.
角色
=
JSON
.
stringify
(
keywords_obj
[
0
].
角色
).
replace
(
/"/g
,
''
);
...
...
This diff is collapsed.
Click to expand it.
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({
}
},
host
:
'0.0.0.0'
,
port
:
952
8
,
port
:
952
9
,
https
:
false
,
}
})
This diff is collapsed.
Click to expand it.
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