优化
This commit is contained in:
@@ -156,7 +156,7 @@
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-section">
|
||||
<a-button
|
||||
v-if="!isPipelineReady"
|
||||
v-if="!isPipelineCompleted"
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!canGenerate"
|
||||
@@ -165,20 +165,13 @@
|
||||
@click="generateAudio"
|
||||
class="action-btn"
|
||||
>
|
||||
{{ isPipelineBusy ? '处理中...' : '生成配音并验证' }}
|
||||
{{ isPipelineBusy ? pipelineStateLabel + '...' : '生成数字人视频' }}
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
v-else
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="isPipelineBusy"
|
||||
block
|
||||
@click="generateDigitalHuman"
|
||||
class="action-btn"
|
||||
>
|
||||
{{ isPipelineBusy ? '处理中...' : '生成数字人视频' }}
|
||||
</a-button>
|
||||
<div v-else class="completed-tip">
|
||||
<span>任务已提交成功</span>
|
||||
<a-button @click="resetPipeline" class="reset-btn">重新生成</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
@@ -252,6 +245,7 @@ const {
|
||||
|
||||
// Pipeline 状态(单一状态源)
|
||||
pipelineState,
|
||||
pipelineStateLabel,
|
||||
isPipelineBusy,
|
||||
isPipelineReady,
|
||||
isPipelineFailed,
|
||||
@@ -269,7 +263,6 @@ const {
|
||||
handleVideoSelect,
|
||||
handleVideoLoaded,
|
||||
replaceVideo,
|
||||
generateDigitalHuman,
|
||||
|
||||
// UI 辅助方法
|
||||
formatDuration,
|
||||
@@ -706,6 +699,35 @@ onMounted(async () => {
|
||||
}
|
||||
}
|
||||
|
||||
.completed-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
padding: 12px 16px;
|
||||
background: #F0FDF4;
|
||||
border: 1px solid #86EFAC;
|
||||
border-radius: 8px;
|
||||
color: #166534;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
|
||||
.reset-btn {
|
||||
padding: 4px 12px;
|
||||
font-size: 13px;
|
||||
color: #3B82F6;
|
||||
border: 1px solid #3B82F6;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 预览面板
|
||||
.preview-card {
|
||||
position: sticky;
|
||||
|
||||
@@ -188,26 +188,8 @@ export function useSimplePipeline(options: PipelineOptions) {
|
||||
}
|
||||
context.value.validationPassed = true
|
||||
|
||||
// 到达 ready 状态
|
||||
setState('ready')
|
||||
|
||||
} catch {
|
||||
// 错误已在各步骤中处理
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数字人任务(从 ready 状态)
|
||||
*/
|
||||
async function createTask(): Promise<void> {
|
||||
if (state.value !== 'ready') {
|
||||
message.warning('请先完成视频识别和音频生成')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// 步骤5: 自动创建任务(校验通过后直接继续)
|
||||
setState('creating')
|
||||
|
||||
const taskData: LipSyncTaskData = {
|
||||
taskName: `数字人任务_${Date.now()}`,
|
||||
videoFileId: context.value.videoFileId!,
|
||||
@@ -229,16 +211,19 @@ export function useSimplePipeline(options: PipelineOptions) {
|
||||
sound_end_time: context.value.audioDurationMs!,
|
||||
}
|
||||
|
||||
const res = await createLipSyncTask(taskData)
|
||||
if (res.code !== 0) {
|
||||
throw new Error(res.msg || '任务创建失败')
|
||||
try {
|
||||
const res = await createLipSyncTask(taskData)
|
||||
if (res.code !== 0) {
|
||||
throw new Error(res.msg || '任务创建失败')
|
||||
}
|
||||
setState('completed')
|
||||
message.success('任务已提交,请在任务中心查看生成进度')
|
||||
} catch (err) {
|
||||
setError(err as Error)
|
||||
}
|
||||
|
||||
setState('completed')
|
||||
message.success('任务已提交,请在任务中心查看生成进度')
|
||||
|
||||
} catch (err) {
|
||||
setError(err as Error)
|
||||
} catch {
|
||||
// 错误已在各步骤中处理
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +286,6 @@ export function useSimplePipeline(options: PipelineOptions) {
|
||||
|
||||
// 方法
|
||||
run,
|
||||
createTask,
|
||||
retry,
|
||||
reset,
|
||||
getExecutionState,
|
||||
|
||||
Reference in New Issue
Block a user