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
7831c281
Commit
7831c281
authored
Feb 01, 2024
by
周成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台修改接口返回local_img_path
parent
0c961014
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
text2videoService.ts
src/api/service/text2videoService.ts
+2
-2
utils.ts
src/utils/utils.ts
+10
-0
index.vue
src/views/home/index.vue
+4
-5
No files found.
src/api/service/text2videoService.ts
View file @
7831c281
...
...
@@ -36,7 +36,7 @@ export default {
width
:
string
=
"960"
,
height
:
string
=
"512"
,
cfg_scale
:
string
=
"9"
,
):
Promise
<
string
>
{
):
Promise
<
{
"domain_image_path"
:
string
,
"local_image_path"
:
string
}
>
{
if
(
!
prompt
)
{
return
Promise
.
reject
(
"SD提示词不能为空"
);
}
...
...
@@ -56,7 +56,7 @@ export default {
.
then
((
res
:
any
)
=>
{
// console.log(res);
if
(
res
&&
res
.
code
===
0
)
{
return
res
.
data
.
result
;
return
{
"domain_image_path"
:
res
.
data
.
result
.
domain_image_path
,
"local_image_path"
:
res
.
data
.
result
.
local_image_path
}
;
}
else
{
const
errorMessage
=
res
?
res
.
message
:
"未知错误"
;
return
Promise
.
reject
(
errorMessage
);
...
...
src/utils/utils.ts
View file @
7831c281
...
...
@@ -32,4 +32,14 @@ export default class utils {
return
formattedDateTime
}
// 拆分文本
static
splitText
(
str
:
string
)
{
// 使用正则表达式拆分文本
let
sentences
=
str
.
split
(
/
[
!|?|。
]
/
);
// 过滤掉长度为 0 的句子
sentences
=
sentences
.
filter
(
s
=>
s
.
length
>
0
);
// console.log(sentences)
return
sentences
}
}
src/views/home/index.vue
View file @
7831c281
...
...
@@ -16,7 +16,6 @@ const form = reactive({
'将上述文案改编为10个短视频分镜,给出每个分镜的场景描述、场景关键词(年代,空间,时间段,地理环境,天气,物品,人物,镜头角度)、角色、角色关键词(性别,年龄,肤色,衣服,发型,发色,脸色,五官特点,体态,情绪,肢体动作)。以如下json字符串的格式返回:{"分镜":[{"编号":"","场景描述":"","场景关键词":"","角色":"","角色关键词":""},...]}'
,
adapt_result
:
""
,
// adapt_result_json:
<
Wm
.
ScriptsItem
[]
>
[],
// adapt_result_json: [{"编号":"1","场景描述":"王强穿越回古代,来到一片战乱的村庄。","场景关键词":"古代,村庄,战乱,医生,王强","角色":"王强","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注"},{"编号":"2","场景描述":"王强在村庄遇见年轻的农民李明。","场景关键词":"村庄,农民,相遇","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"},{"编号":"3","场景描述":"王强教授李明基本的医术。","场景关键词":"教学,医术,基本","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"},{"编号":"4","场景描述":"王强帮助李明恢复村庄秩序。","场景关键词":"村庄,恢复秩序","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"},{"编号":"5","场景描述":"王强在古代使用现代医学知识治愈疾病。","场景关键词":"古代,医学知识,治愈疾病","角色":"王强","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注"},{"编号":"6","场景描述":"王强组建抗击恶势力的义勇军。","场景关键词":"抗击恶势力,义勇军","角色":"王强","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注"},{"编号":"7","场景描述":"王强与正义的侠盗团队合作。","场景关键词":"侠盗团队,合作","角色":"王强","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注"},{"编号":"8","场景描述":"王强、李明和侠盗团队共同对抗恶势力。","场景关键词":"共同对抗,恶势力","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"},{"编号":"9","场景描述":"王强和他的队伍驱逐恶势力,村庄恢复和平。","场景关键词":"驱逐恶势力,村庄和平","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"},{"编号":"10","场景描述":"王强和李明成为好朋友,守护村庄的和平与安宁。","场景关键词":"好朋友,守护和平,安宁","角色":"王强,李明","角色关键词":"男性,中年,普通,医生白大褂,干练,自信,坚定,专注;男性,青年,普通,农民服装,干净,精明,忧伤"}],
adapt_result_json
:
[
{
"编号"
:
"1"
,
...
...
@@ -275,7 +274,7 @@ const onDraw = async () => {
try
{
const
result
=
await
text2videoService
.
submitGpt
(
// `场景描述为:${item.场景描述}\n场景关键词为:${item.场景关键词}\n场景中的角色有:${item.角色}\n角色关键词为:${item.角色关键词}\n请理解以上内容,并翻译为相应的英文场景,保留人物和场景的特征和描写。以如下格式返回:Scene:... \nCharacters:...\n`
`场景描述为:
${
item
.
场景描述
}
\n场景关键词为:
${
item
.
场景关键词
}
\n场景中的角色有:
${
item
.
角色
}
\n角色关键词为:
${
item
.
角色关键词
}
\n请理解以上内容,并翻译为相应的英文
场景,返回结果不允许有中文
。`
`场景描述为:
${
item
.
场景描述
}
\n场景关键词为:
${
item
.
场景关键词
}
\n场景中的角色有:
${
item
.
角色
}
\n角色关键词为:
${
item
.
角色关键词
}
\n请理解以上内容,并翻译为相应的英文。`
);
// const newResult = result.replaceAll(".", "").replaceAll('"', "");
const
newResult
=
result
...
...
@@ -291,7 +290,7 @@ const onDraw = async () => {
编号
:
item
.
编号
,
场景描述
:
item
.
场景描述
,
画面描述词
:
newResult
,
本镜配图
:
sd_result
,
本镜配图
:
sd_result
.
domain_image_path
,
task_id
:
task_id
,
};
}
catch
(
error
)
{
...
...
@@ -348,10 +347,10 @@ const onDrawOne = (idxStr: string) => {
const
sd_prompt
=
newResult
+
","
+
sd_prompt_prefix
;
text2videoService
.
submitSD
(
task_id
,
idxStr
,
sd_prompt
,
sd_negative_prompt_prefix
)
.
then
((
result
:
string
)
=>
{
.
then
((
sd_result
:
any
)
=>
{
// console.log(result);
form
.
ai_draw_json
[
idx
].
本镜配图
=
""
;
form
.
ai_draw_json
[
idx
].
本镜配图
=
result
;
form
.
ai_draw_json
[
idx
].
本镜配图
=
sd_result
.
domain_image_path
;
})
.
catch
((
error
:
any
)
=>
{
// console.error(error);
...
...
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