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
2196ffd6
Commit
2196ffd6
authored
Nov 10, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
cf7d8130
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
218 additions
and
37 deletions
+218
-37
index.html
form/index.html
+61
-31
index.js
form/index.js
+157
-6
No files found.
form/index.html
View file @
2196ffd6
...
...
@@ -39,8 +39,8 @@
<el-button
type=
"primary"
icon=
"el-icon-upload"
>
上传视频
</el-button>
</el-upload>
<el-button
v-if=
"videoUrl"
type=
"warning"
icon=
"el-icon-refresh"
@
click=
"confirmReupload"
>
重新上传
</el-button>
<el-button
v-if=
"videoUrl"
type=
"primary"
@
click=
"generateSubtitles"
>
{{ subtitlesResult ? '重新生成字幕' : '生成字幕' }}
</el-button>
<el-button
v-if=
"videoUrl"
type=
"success"
@
click=
"removeVocals"
>
去
人声
</el-button>
<el-button
v-if=
"videoUrl"
type=
"primary"
@
click=
"generateSubtitles"
:disabled=
"isAnyTaskRunning()"
>
{{ subtitlesResult ? '重新生成字幕' : '生成字幕' }}
</el-button>
<el-button
v-if=
"videoUrl"
type=
"success"
@
click=
"removeVocals"
:disabled=
"isAnyTaskRunning()"
>
AI去除
人声
</el-button>
<!-- 上传进度条 -->
<div
v-if=
"uploading"
class=
"upload-progress"
>
...
...
@@ -57,6 +57,8 @@
</div>
</div>
<!-- 视频播放区域 -->
<div
class=
"video-section"
v-if=
"videoUrl"
>
<video
...
...
@@ -67,48 +69,76 @@
</video>
</div>
<!-- 任务状态看板 -->
<div
class=
"task-board"
v-if=
"
(loadingText || task_uuid) && !subtitlesResult
"
style=
"max-width:800px;margin-top:16px;"
>
<!-- 任务状态看板
(统一:字幕/去人声 共用)
-->
<div
class=
"task-board"
v-if=
"
task_uuid || vocalTaskUuid
"
style=
"max-width:800px;margin-top:16px;"
>
<el-card
shadow=
"hover"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
任务状态
</span>
<el-tag
v-if=
"
task_uuid
"
size=
"mini"
type=
"info"
style=
"float:right;"
>
进行中
</el-tag>
<el-tag
v-if=
"
getCurrentTaskUuid()
"
size=
"mini"
type=
"info"
style=
"float:right;"
>
进行中
</el-tag>
</div>
<div
class=
"board-row"
style=
"margin-bottom:8px;"
>
<span
style=
"color:#909399;"
>
任务UUID:
</span>
<span>
{{
task_uuid
|| '—' }}
</span>
<span>
{{
getCurrentTaskUuid()
|| '—' }}
</span>
</div>
<div
class=
"board-row"
>
<span
style=
"color:#909399;"
>
状态与进度:
</span>
<span>
{{
loadingText
|| '—' }}
</span>
<span>
{{
getCurrentLoadingText()
|| '—' }}
</span>
</div>
</el-card>
</div>
<!-- 生成结果看板 -->
<div
class=
"result-board"
v-if=
"subtitlesResult"
style=
"max-width:800px;margin-top:16px;"
>
<el-card
shadow=
"hover"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
字幕生成结果
</span>
<el-tag
size=
"mini"
type=
"success"
style=
"float:right;"
>
已完成
</el-tag>
</div>
<div>
<el-alert
type=
"info"
:closable=
"false"
show-icon
title=
"点击以下链接可下载或预览对应资源"
></el-alert>
<el-table
:data=
"Object.keys(subtitlesResult).map(k => ({ key: k, value: subtitlesResult[k] }))"
style=
"width: 100%; margin-top: 12px;"
size=
"mini"
:border=
"true"
>
<el-table-column
label=
"生成资源"
width=
"220"
>
<template
slot-scope=
"scope"
>
{{ getSubtitleKeyZh(scope.row.key) }}
</template>
</el-table-column>
<el-table-column
label=
"链接"
>
<template
slot-scope=
"scope"
>
<a
v-if=
"typeof scope.row.value === 'string' && /^https?:\/\//.test(scope.row.value)"
:href=
"scope.row.value"
target=
"_blank"
>
{{ scope.row.value }}
</a>
<span
v-else
>
—
</span>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<!-- 结果区:同排展示两个结果卡片 -->
<div
class=
"results-row"
v-if=
"subtitlesResult || vocalResult"
style=
"display:flex; gap:16px; flex-wrap:wrap; width: 90%; margin-top:16px;"
>
<!-- 生成结果看板:字幕 -->
<div
class=
"result-board"
v-if=
"subtitlesResult"
style=
"flex:0 0 40%; width:40%;"
>
<el-card
shadow=
"hover"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
字幕生成结果
</span>
<el-tag
size=
"mini"
type=
"success"
style=
"float:right;"
>
已完成
</el-tag>
</div>
<div>
<el-alert
type=
"info"
:closable=
"false"
show-icon
title=
"点击以下链接可下载或预览对应资源"
></el-alert>
<el-table
:data=
"Object.keys(subtitlesResult).map(k => ({ key: k, value: subtitlesResult[k] }))"
style=
"width: 100%; margin-top: 12px;"
size=
"mini"
:border=
"true"
>
<el-table-column
label=
"生成资源"
width=
"220"
>
<template
slot-scope=
"scope"
>
{{ getSubtitleKeyZh(scope.row.key) }}
</template>
</el-table-column>
<el-table-column
label=
"链接"
>
<template
slot-scope=
"scope"
>
<a
v-if=
"typeof scope.row.value === 'string' && /^https?:\/\//.test(scope.row.value)"
:href=
"scope.row.value"
target=
"_blank"
>
{{ scope.row.value }}
</a>
<span
v-else
>
—
</span>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
<!-- 生成结果看板:视频处理(去人声/静音/仅人声) -->
<div
class=
"result-board"
v-if=
"vocalResult"
style=
"flex:0 0 40%;"
>
<el-card
shadow=
"hover"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
视频处理结果(去人声/静音/仅人声)
</span>
<el-tag
size=
"mini"
type=
"success"
style=
"float:right;"
>
已完成
</el-tag>
</div>
<div>
<el-alert
type=
"info"
:closable=
"false"
show-icon
title=
"点击以下链接可下载或预览对应资源"
></el-alert>
<el-table
:data=
"Object.keys(vocalResult).map(k => ({ key: k, value: vocalResult[k] }))"
style=
"width: 100%; margin-top: 12px;"
size=
"mini"
:border=
"true"
>
<el-table-column
label=
"生成资源"
width=
"260"
>
<template
slot-scope=
"scope"
>
{{ vocalResourceLabel(scope.row.key) }}
</template>
</el-table-column>
<el-table-column
label=
"链接"
>
<template
slot-scope=
"scope"
>
<a
v-if=
"typeof scope.row.value === 'string' && /^https?:\/\//.test(scope.row.value)"
:href=
"scope.row.value"
target=
"_blank"
>
{{ scope.row.value }}
</a>
<span
v-else
>
—
</span>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</div>
</div>
</div>
...
...
form/index.js
View file @
2196ffd6
...
...
@@ -66,6 +66,11 @@ function initVueApp(savedData) {
task_uuid
:
''
,
subtitlesResult
:
null
,
subtitlePollTimer
:
null
,
// 去人声相关
vocalTaskUuid
:
''
,
vocalResult
:
null
,
vocalPollTimer
:
null
,
vocalLoadingText
:
''
,
},
mounted
()
{
// 如果有保存的数据,恢复状态
...
...
@@ -86,6 +91,14 @@ function initVueApp(savedData) {
if
(
savedData
&&
savedData
.
subtitlesResult
)
{
this
.
subtitlesResult
=
savedData
.
subtitlesResult
;
}
// 恢复去人声任务/结果
if
(
savedData
&&
savedData
.
vocalTaskUuid
)
{
this
.
vocalTaskUuid
=
savedData
.
vocalTaskUuid
;
this
.
startVocalPolling
();
}
if
(
savedData
&&
savedData
.
vocalResult
)
{
this
.
vocalResult
=
savedData
.
vocalResult
;
}
},
beforeDestroy
()
{
...
...
@@ -97,9 +110,25 @@ function initVueApp(savedData) {
clearInterval
(
this
.
subtitlePollTimer
);
this
.
subtitlePollTimer
=
null
;
}
if
(
this
.
vocalPollTimer
)
{
clearInterval
(
this
.
vocalPollTimer
);
this
.
vocalPollTimer
=
null
;
}
},
methods
:
{
// 结果 key -> 中文名称
// 是否有任一任务在进行中(按钮禁用统一判断)
isAnyTaskRunning
()
{
return
!!
(
this
.
subtitlePollTimer
||
this
.
vocalPollTimer
||
(
this
.
task_uuid
&&
this
.
task_uuid
.
length
>
0
)
||
(
this
.
vocalTaskUuid
&&
this
.
vocalTaskUuid
.
length
>
0
));
},
// 统一任务状态 - 当前任务 UUID
getCurrentTaskUuid
()
{
return
this
.
task_uuid
||
this
.
vocalTaskUuid
;
},
// 统一任务状态 - 当前任务状态文本
getCurrentLoadingText
()
{
return
this
.
loadingText
||
this
.
vocalLoadingText
;
},
// 结果 key -> 中文名称(字幕)
getSubtitleKeyZh
(
key
)
{
const
map
=
{
audioUrl
:
'
提取音频
'
,
...
...
@@ -116,6 +145,24 @@ function initVueApp(savedData) {
};
return
map
[
key
]
||
key
;
},
// 结果 key -> 中文名称(去人声)
getVocalKeyZh
(
key
)
{
const
map
=
{
removeVocalUrl
:
'
去人声视频
'
,
onlyVocalUrl
:
'
仅人声视频
'
,
noAudioUrl
:
'
静音视频
'
,
};
return
map
[
key
]
||
key
;
},
// 生成资源列(去人声):对指定 key 追加括号显示原 key
vocalResourceLabel
(
key
)
{
const
special
=
[
'
noAudioUrl
'
,
'
onlyVocalUrl
'
,
'
removeVocalUrl
'
];
const
zh
=
this
.
getVocalKeyZh
(
key
);
if
(
special
.
indexOf
(
key
)
!==
-
1
)
{
return
`
${
zh
}
(
${
key
}
)`
;
}
return
zh
;
},
// 检查 URL 资源是否有效
async
checkUrlValid
(
url
)
{
try
{
...
...
@@ -184,6 +231,10 @@ function initVueApp(savedData) {
this
.
stopSubtitlePolling
();
const
err
=
row
.
error_msg
||
'
字幕生成失败
'
;
this
.
$message
.
error
(
err
);
// 清理以允许重新发起
this
.
loadingText
=
''
;
this
.
task_uuid
=
''
;
this
.
saveData
();
}
}
else
{
// 非200或无数据,不终止,继续轮询
...
...
@@ -201,6 +252,57 @@ function initVueApp(savedData) {
}
},
// 开始去人声任务轮询
startVocalPolling
(
taskUuid
)
{
const
uuid
=
taskUuid
||
this
.
vocalTaskUuid
;
if
(
!
uuid
)
return
;
this
.
stopVocalPolling
();
const
base
=
this
.
getApiBase
();
this
.
vocalLoadingText
=
'
去人声任务已创建,正在处理...
'
;
this
.
vocalPollTimer
=
setInterval
(
async
()
=>
{
try
{
const
resp
=
await
fetch
(
`
${
base
}
/open/api/ai/dpe/v1/common/task?task_uuid=
${
encodeURIComponent
(
uuid
)}
`
,
{
method
:
'
GET
'
,
mode
:
'
cors
'
,
cache
:
'
no-cache
'
});
const
json
=
await
resp
.
json
();
if
(
json
&&
json
.
code
===
200
&&
json
.
data
)
{
const
row
=
json
.
data
;
const
status
=
row
.
status_
;
const
progress
=
row
.
progress
||
0
;
const
progressMsg
=
row
.
progress_msg
||
''
;
this
.
vocalLoadingText
=
`去人声处理状态:
${
status
==
0
?
'
未开始
'
:
status
==
1
?
'
进行中
'
:
status
==
2
?
'
已完成
'
:
status
==
3
?
'
失败
'
:
'
未知
'
}
进度:
${
progress
}
%
${
progressMsg
}
`
;
if
(
status
===
2
)
{
this
.
stopVocalPolling
();
this
.
$message
.
success
(
'
去人声处理完成
'
);
this
.
vocalResult
=
row
.
res_data
||
null
;
this
.
vocalLoadingText
=
''
;
this
.
vocalTaskUuid
=
''
;
this
.
saveData
();
}
else
if
(
status
===
3
)
{
this
.
stopVocalPolling
();
const
err
=
row
.
error_msg
||
'
去人声处理失败
'
;
this
.
$message
.
error
(
err
);
// 清理以允许重新发起
this
.
vocalLoadingText
=
''
;
this
.
vocalTaskUuid
=
''
;
this
.
saveData
();
}
}
}
catch
(
e
)
{
// 忽略瞬时错误
}
},
1000
);
},
stopVocalPolling
()
{
if
(
this
.
vocalPollTimer
)
{
clearInterval
(
this
.
vocalPollTimer
);
this
.
vocalPollTimer
=
null
;
}
},
async
deepCheckUtilHave
(
url
)
{
let
isHave
=
await
this
.
checkUrlValid
(
url
);
let
count
=
0
;
...
...
@@ -437,8 +539,8 @@ function initVueApp(savedData) {
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
return
;
}
if
(
this
.
task_uuid
)
{
this
.
$message
.
warning
(
'
字幕任务正在处理中,请稍
后再试
'
);
if
(
this
.
task_uuid
||
this
.
vocalTaskUuid
)
{
this
.
$message
.
warning
(
'
有任务正在处理中,请等待完成
后再试
'
);
return
;
}
if
(
this
.
subtitlesResult
!=
null
)
{
...
...
@@ -487,11 +589,54 @@ function initVueApp(savedData) {
// 去人声
async
removeVocals
()
{
const
videoUrl
=
(
this
.
videoUrl
||
''
).
replace
(
'
_mini.mp4
'
,
'
.mp4
'
);
if
(
!
videoUrl
)
{
this
.
$message
.
warning
(
'
请先上传或选择视频
'
);
return
;
}
if
(
this
.
vocalTaskUuid
||
this
.
task_uuid
)
{
this
.
$message
.
warning
(
'
有任务正在处理中,请等待完成后再试
'
);
return
;
}
if
(
this
.
vocalResult
!=
null
)
{
this
.
$confirm
(
'
去人声结果已生成,重新处理将覆盖现有结果,是否继续?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(()
=>
{
this
.
vocalTaskUuid
=
null
;
this
.
vocalResult
=
null
;
this
.
vocalLoadingText
=
''
;
this
.
saveData
();
this
.
removeVocals
();
}).
catch
(()
=>
{
});
return
;
}
// 新任务启动前清空旧文案/结果
this
.
vocalResult
=
null
;
this
.
vocalLoadingText
=
''
;
const
base
=
this
.
getApiBase
();
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
正在提交去人声任务...
'
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
try
{
this
.
$message
.
info
(
'
开始去人声处理...
'
);
// TODO: 在此处接入去人声的业务逻辑(例如调用后端音频分离服务)
const
resp
=
await
fetch
(
`
${
base
}
/open/api/ai/dpe/v1/video/vocalbgmute`
,
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
({
video_url
:
videoUrl
})
});
const
json
=
await
resp
.
json
();
if
(
json
&&
json
.
code
===
200
&&
json
.
task_uuid
)
{
this
.
$message
.
success
(
'
去人声任务创建成功
'
);
this
.
vocalTaskUuid
=
json
.
task_uuid
;
this
.
saveData
();
this
.
startVocalPolling
();
}
else
{
this
.
$message
.
error
(
json
&&
(
json
.
message
||
json
.
msg
)
?
(
json
.
message
||
json
.
msg
)
:
'
创建去人声任务失败
'
);
}
}
catch
(
e
)
{
this
.
$message
.
error
(
'
去人声失败
'
);
this
.
$message
.
error
(
'
创建去人声任务失败
'
);
}
finally
{
loading
.
close
();
}
},
...
...
@@ -507,6 +652,12 @@ function initVueApp(savedData) {
if
(
this
.
subtitlesResult
!=
null
)
{
data
.
subtitlesResult
=
this
.
subtitlesResult
;
}
if
(
this
.
vocalTaskUuid
)
{
data
.
vocalTaskUuid
=
this
.
vocalTaskUuid
;
}
if
(
this
.
vocalResult
!=
null
)
{
data
.
vocalResult
=
this
.
vocalResult
;
}
window
.
courseware
.
setData
(
data
,
function
()
{
},
key
);
},
...
...
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