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
1f769e0a
Commit
1f769e0a
authored
Mar 05, 2024
by
周成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同
parent
3c4b5be9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
6 deletions
+38
-6
index.vue
src/views/home/index.vue
+38
-6
No files found.
src/views/home/index.vue
View file @
1f769e0a
...
...
@@ -348,17 +348,49 @@ const onAdaptOneSceneRoles = async (item: any) => {
// console.log(adapt_role_restrict)
// console.log(item_roles)
item
.
角色
=
item_roles
.
trim
();
////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【begin】
const
temp_arr
=
item
.
角色
.
split
(
/
[
,,、
]
/
);
const
temp_arr_length
=
temp_arr
.
length
;
////// 如果本镜的角色大于1个,则只保留没有出现过的角色,且保证只有一个
if
(
temp_arr_length
>
1
)
{
////// 获取本镜之前的所有角色
let
role_history
=
""
;
form
.
adapt_result_json
.
forEach
(
scene
=>
{
if
(
scene
.
编号
<
item
.
编号
)
{
role_history
+=
scene
.
角色
+
","
;
}
})
for
(
const
temp
of
temp_arr
)
{
if
(
role_history
.
includes
(
temp
))
{
item
.
角色
=
""
;
continue
;
}
else
{
item
.
角色
=
temp
;
break
;
}
}
if
(
item
.
角色
==
""
)
{
const
role_history_arr
=
role_history
.
split
(
','
);
if
(
role_history_arr
.
length
>=
2
)
{
item
.
角色
=
role_history_arr
[
role_history_arr
.
length
-
2
];
}
else
if
(
role_history_arr
.
length
==
1
)
{
item
.
角色
=
role_history_arr
[
role_history_arr
.
length
-
1
];
}
else
{
item
.
角色
=
item_roles
.
trim
();
}
}
}
////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【end】
// 开始匹配角色关键词
let
role_kws
=
""
let
role_kws_en
=
""
const
item_roles_arr
=
item
_roles
.
split
(
/
[
,,、
]
/
);
item_roles_arr
.
forEach
(
one_item_role
=>
{
const
item_roles_arr
=
item
.
角色
.
split
(
/
[
,,、
]
/
);
item_roles_arr
.
forEach
(
(
one_item_role
:
string
)
=>
{
let
temp_role_kws
=
""
let
temp_role_kws_en
=
""
// 人工匹配角色关键词,先找想同的
for
(
const
i
of
form
.
chatgpt_answer_roles
)
{
if
(
i
[
"角色"
].
trim
()
==
one_item_role
.
trim
())
{
temp_role_kws
=
`
[
${
i
[
"角色关键词"
]}
]
`
;
temp_role_kws_en
=
`
[
${
i
[
"角色关键词英文"
]}
]
`
;
temp_role_kws
=
`
${
i
[
"角色关键词"
]}
`
;
temp_role_kws_en
=
`
${
i
[
"角色关键词英文"
]}
`
;
// 找到就ok
break
;
}
...
...
@@ -367,8 +399,8 @@ const onAdaptOneSceneRoles = async (item: any) => {
if
(
!
temp_role_kws
)
{
for
(
const
i
of
form
.
chatgpt_answer_roles
)
{
if
(
i
[
"角色"
].
includes
(
one_item_role
.
trim
())
||
one_item_role
.
includes
(
i
[
"角色"
].
trim
()))
{
temp_role_kws
=
`
[
${
i
[
"角色关键词"
]}
]
`
;
temp_role_kws_en
=
`
[
${
i
[
"角色关键词英文"
]}
]
`
;
temp_role_kws
=
`
${
i
[
"角色关键词"
]}
`
;
temp_role_kws_en
=
`
${
i
[
"角色关键词英文"
]}
`
;
// 匹配到一个就ok
break
;
}
...
...
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