f5100b7b5d
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 52s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 55s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m53s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m9s
AI Code Review / AI Code Review (pull_request) Failing after 2m19s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m34s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 3m8s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 41s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m29s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m3s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m18s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 3m27s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 8m34s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 17m7s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 5m12s
CI/CD Pipeline / CI Gate (pull_request) Failing after 20s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 56s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Waiting to run
- 配音预览逻辑优化:优先检查 selectedVoice 是否为已上传素材 - 如果是上传素材,直接使用其 file_url 作为预览音频 - 仅对预设音色或克隆音色调用 previewTts 接口合成 - 切换配音或标题时自动重新生成预览音频 解决用户反馈:Step3 选择上传的配音素材后预览无声音的问题
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
/**
|
|
* GeneratePage 步骤导航
|
|
* 管理步骤切换与各步骤的前置校验
|
|
* 步骤顺序:模板(1) → 素材(2) → 配音(3) → 标题(4) → 预览(5) → 封面(6) → 确认(7)
|
|
*
|
|
* V24: previewReady 改为前端素材加载状态
|
|
*/
|
|
import { message } from "antd"
|
|
import type { TitleSettings } from "../types"
|
|
|
|
export interface UseStepNavigationOptions {
|
|
currentStep: number
|
|
setCurrentStep: (step: number | ((prev: number) => number)) => void
|
|
selectedTemplate: string
|
|
materialMode: "manual" | "auto"
|
|
selectedMaterials: string[]
|
|
smartSelectedIds: string[]
|
|
titleSettings: TitleSettings
|
|
/** 预览是否就绪(前端素材已加载) */
|
|
previewReady: boolean
|
|
}
|
|
|
|
export interface UseStepNavigationReturn {
|
|
goNext: () => void
|
|
goPrev: () => void
|
|
}
|
|
|
|
export const useStepNavigation = (options: UseStepNavigationOptions): UseStepNavigationReturn => {
|
|
const {
|
|
currentStep,
|
|
setCurrentStep,
|
|
selectedTemplate,
|
|
materialMode,
|
|
selectedMaterials,
|
|
smartSelectedIds,
|
|
titleSettings,
|
|
previewReady,
|
|
} = options
|
|
|
|
const goNext = () => {
|
|
if (currentStep === 1 && !selectedTemplate) {
|
|
message.warning("请先选择一个模板")
|
|
return
|
|
}
|
|
if (currentStep === 2 && materialMode === "manual" && selectedMaterials.length === 0) {
|
|
message.warning("请至少选择一个素材")
|
|
return
|
|
}
|
|
if (currentStep === 2 && materialMode === "auto" && smartSelectedIds.length === 0) {
|
|
message.warning("请先进行智能匹配并选择素材")
|
|
return
|
|
}
|
|
// Step3 配音:配音为可选项,不强制校验,用户可跳过
|
|
if (currentStep === 4 && !titleSettings.title.trim()) {
|
|
message.warning("请选择或输入标题")
|
|
return
|
|
}
|
|
if (currentStep === 5 && !previewReady) {
|
|
message.warning("请先选择素材以预览效果")
|
|
return
|
|
}
|
|
if (currentStep < 7) {
|
|
setCurrentStep((s) => s + 1)
|
|
}
|
|
}
|
|
|
|
const goPrev = () => {
|
|
if (currentStep > 1) {
|
|
setCurrentStep((s) => s - 1)
|
|
}
|
|
}
|
|
|
|
return { goNext, goPrev }
|
|
}
|
|
|
|
export default useStepNavigation
|