Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ai_fundub
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
ai_fundub
Commits
e4661791
Commit
e4661791
authored
Oct 14, 2026
by
Jeff nan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
5891dc93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
index.js
form/index.js
+28
-17
No files found.
form/index.js
View file @
e4661791
...
@@ -227,13 +227,23 @@ function initVueApp(savedData) {
...
@@ -227,13 +227,23 @@ function initVueApp(savedData) {
.
map
((
k
)
=>
({
key
:
k
,
value
:
data
[
k
]
}));
.
map
((
k
)
=>
({
key
:
k
,
value
:
data
[
k
]
}));
},
},
async
getAuthKey
()
{
async
getAuthKey
()
{
const
resp
=
await
callServerMethod
(
'
getAuthKey
'
);
// courseware 同名事件不能并发监听:并行调用会互相覆盖,只保留最后一次
if
(
resp
.
msg
==
'
success
'
)
{
if
(
this
.
_getAuthKeyInflight
)
{
return
resp
.
data
;
return
this
.
_getAuthKeyInflight
;
}
else
{
this
.
$message
.
error
(
resp
.
data
);
return
''
;
}
}
this
.
_getAuthKeyInflight
=
(
async
()
=>
{
try
{
const
resp
=
await
callServerMethod
(
'
getAuthKey
'
);
if
(
resp
.
msg
==
'
success
'
)
{
return
resp
.
data
;
}
this
.
$message
.
error
(
resp
.
data
);
return
''
;
}
finally
{
this
.
_getAuthKeyInflight
=
null
;
}
})();
return
this
.
_getAuthKeyInflight
;
},
},
// 结果 key -> 中文名称(去人声)
// 结果 key -> 中文名称(去人声)
getVocalKeyZh
(
key
)
{
getVocalKeyZh
(
key
)
{
...
@@ -284,11 +294,11 @@ function initVueApp(savedData) {
...
@@ -284,11 +294,11 @@ function initVueApp(savedData) {
return
isStaging
?
'
https://stagingopensource.iteachabc.com
'
:
'
https://opensource.iteachabc.com
'
;
return
isStaging
?
'
https://stagingopensource.iteachabc.com
'
:
'
https://opensource.iteachabc.com
'
;
},
},
// open API 鉴权 query:auth_key / user_sign
// open API 鉴权 query:auth_key / user_sign
(可传入已获取的 authKey,避免重复请求)
async
appendApiAuthQuery
(
url
)
{
async
appendApiAuthQuery
(
url
,
authKey
)
{
const
authKey
=
await
this
.
getAuthKey
();
const
key
=
authKey
!=
null
?
authKey
:
await
this
.
getAuthKey
();
const
sep
=
url
.
includes
(
'
?
'
)
?
'
&
'
:
'
?
'
;
const
sep
=
url
.
includes
(
'
?
'
)
?
'
&
'
:
'
?
'
;
return
`
${
url
}${
sep
}
auth_key=
${
encodeURIComponent
(
authK
ey
||
''
)}
&user_sign=
${
encodeURIComponent
(
'
syllabus_cw_make
'
)}
`
;
return
`
${
url
}${
sep
}
auth_key=
${
encodeURIComponent
(
k
ey
||
''
)}
&user_sign=
${
encodeURIComponent
(
'
syllabus_cw_make
'
)}
`
;
},
},
// 开始字幕任务轮询
// 开始字幕任务轮询
...
@@ -574,9 +584,10 @@ function initVueApp(savedData) {
...
@@ -574,9 +584,10 @@ function initVueApp(savedData) {
this
.
videoUrl
=
res
;
this
.
videoUrl
=
res
;
this
.
$message
.
success
(
'
视频上传成功!
'
);
this
.
$message
.
success
(
'
视频上传成功!
'
);
this
.
saveData
();
this
.
saveData
();
// 自动并行触发两个任务
// 自动并行触发两个任务(共用一次 auth_key)
this
.
generateSubtitles
();
const
authKey
=
await
this
.
getAuthKey
();
this
.
removeVocals
();
this
.
generateSubtitles
(
authKey
);
this
.
removeVocals
(
authKey
);
}
}
});
});
// 开始上传,显示进度条
// 开始上传,显示进度条
...
@@ -633,7 +644,7 @@ function initVueApp(savedData) {
...
@@ -633,7 +644,7 @@ function initVueApp(savedData) {
},
},
// 生成字幕
// 生成字幕
async
generateSubtitles
()
{
async
generateSubtitles
(
authKey
)
{
const
videoUrl
=
(
this
.
videoUrl
||
''
);
const
videoUrl
=
(
this
.
videoUrl
||
''
);
if
(
!
videoUrl
)
{
if
(
!
videoUrl
)
{
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
...
@@ -666,7 +677,7 @@ function initVueApp(savedData) {
...
@@ -666,7 +677,7 @@ function initVueApp(savedData) {
const
base
=
this
.
getApiBase
();
const
base
=
this
.
getApiBase
();
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
正在提交字幕任务...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
正在提交字幕任务...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
try
{
try
{
const
url
=
await
this
.
appendApiAuthQuery
(
`
${
base
}
/open/api/ai/dpe/v1/video/subtitles`
);
const
url
=
await
this
.
appendApiAuthQuery
(
`
${
base
}
/open/api/ai/dpe/v1/video/subtitles`
,
authKey
);
const
resp
=
await
fetch
(
url
,
{
const
resp
=
await
fetch
(
url
,
{
method
:
'
POST
'
,
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
...
@@ -689,7 +700,7 @@ function initVueApp(savedData) {
...
@@ -689,7 +700,7 @@ function initVueApp(savedData) {
},
},
// 去人声
// 去人声
async
removeVocals
()
{
async
removeVocals
(
authKey
)
{
const
videoUrl
=
(
this
.
videoUrl
||
''
);
const
videoUrl
=
(
this
.
videoUrl
||
''
);
if
(
!
videoUrl
)
{
if
(
!
videoUrl
)
{
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
...
@@ -720,7 +731,7 @@ function initVueApp(savedData) {
...
@@ -720,7 +731,7 @@ function initVueApp(savedData) {
const
base
=
this
.
getApiBase
();
const
base
=
this
.
getApiBase
();
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
正在提交去人声任务...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
正在提交去人声任务...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
try
{
try
{
const
url
=
await
this
.
appendApiAuthQuery
(
`
${
base
}
/open/api/ai/dpe/v1/video/vocalbgmute`
);
const
url
=
await
this
.
appendApiAuthQuery
(
`
${
base
}
/open/api/ai/dpe/v1/video/vocalbgmute`
,
authKey
);
const
resp
=
await
fetch
(
url
,
{
const
resp
=
await
fetch
(
url
,
{
method
:
'
POST
'
,
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
...
...
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