refactor: 清理预览旧架构 — 删除 confirmGeneration 调用 + previewTaskId 链路
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m5s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m17s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m54s
CI/CD Pipeline / Build Staging API Image (push) Successful in 2m58s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 6m14s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 6m14s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m24s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 43s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m11s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 9m14s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m16s
CI/CD Pipeline / Unit Tests (push) Successful in 13m45s
CI/CD Pipeline / Integration Tests (push) Successful in 5m1s
CI/CD Pipeline / CI Gate (push) Failing after 666h26m43s
CI/CD Pipeline / Canary Release to Production (push) Failing after 666h27m9s
CI/CD Pipeline / Deploy Production (push) Failing after 666h27m9s
CI/CD Pipeline / Build Production Web Image (push) Failing after 666h27m10s
CI/CD Pipeline / Build Production API Image (push) Failing after 666h27m10s
CI/CD Pipeline / PR Build Web Image (push) Failing after 666h40m54s
CI/CD Pipeline / PR Build API Image (push) Failing after 666h40m56s
CI/CD Pipeline / Frontend Lint (push) Failing after 666h40m58s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 666h41m0s
CI/CD Pipeline / Production Browser E2E (push) Failing after 667h0m53s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 667h0m54s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 667h14m38s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m5s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m17s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m54s
CI/CD Pipeline / Build Staging API Image (push) Successful in 2m58s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 6m14s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 6m14s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m24s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 43s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m11s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 9m14s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m16s
CI/CD Pipeline / Unit Tests (push) Successful in 13m45s
CI/CD Pipeline / Integration Tests (push) Successful in 5m1s
CI/CD Pipeline / CI Gate (push) Failing after 666h26m43s
CI/CD Pipeline / Canary Release to Production (push) Failing after 666h27m9s
CI/CD Pipeline / Deploy Production (push) Failing after 666h27m9s
CI/CD Pipeline / Build Production Web Image (push) Failing after 666h27m10s
CI/CD Pipeline / Build Production API Image (push) Failing after 666h27m10s
CI/CD Pipeline / PR Build Web Image (push) Failing after 666h40m54s
CI/CD Pipeline / PR Build API Image (push) Failing after 666h40m56s
CI/CD Pipeline / Frontend Lint (push) Failing after 666h40m58s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 666h41m0s
CI/CD Pipeline / Production Browser E2E (push) Failing after 667h0m53s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 667h0m54s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 667h14m38s
- useGenerateVideo: 删除 confirmGeneration 导入和调用,改为 TODO 占位 - GeneratePage: 删除 previewTaskId 硬编码空字符串 - types: 删除 previewTaskId 字段定义 - api/generation: 删除 confirmGeneration 导出和 ConfirmGeneration 类型导出 - createPreview/getPreviewStatus 保留(useStep6Cover 封面流程仍在使用)
This commit is contained in:
@@ -3,13 +3,9 @@ export type {
|
||||
CreatePreviewRequest,
|
||||
CreatePreviewResponse,
|
||||
PreviewTaskResponse,
|
||||
ConfirmGenerationRequest,
|
||||
ConfirmGenerationResponse,
|
||||
ConfirmGenerationTaskItem,
|
||||
} from "./types"
|
||||
|
||||
export { createPreview, getPreviewStatus } from "./preview"
|
||||
export { confirmGeneration } from "./confirm"
|
||||
|
||||
export { generateCover } from "./cover"
|
||||
export type { GenerateCoverRequest, GenerateCoverResponse } from "./cover"
|
||||
|
||||
@@ -171,7 +171,6 @@ const GeneratePage: React.FC = () => {
|
||||
autoSubtitles,
|
||||
bgm,
|
||||
generateCount,
|
||||
previewTaskId: "",
|
||||
})
|
||||
|
||||
/* ================================================================
|
||||
|
||||
@@ -19,8 +19,6 @@ export interface UseGenerateVideoProps {
|
||||
autoSubtitles: boolean
|
||||
bgm: boolean
|
||||
generateCount: number
|
||||
/** 预览任务的 task_id(用于新确认生成 API) */
|
||||
previewTaskId: string
|
||||
}
|
||||
|
||||
/** 生成阶段 */
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import { useState, useCallback } from "react"
|
||||
import { message } from "antd"
|
||||
import type { GeneratedVideo } from "@/api/template-editor"
|
||||
import { confirmGeneration } from "@/api/generation"
|
||||
import type { UseGenerateVideoProps } from "./generate-video/types"
|
||||
import { getGenerationPhase } from "./generate-video/phase"
|
||||
import { useGenerationPolling } from "./generate-video/useGenerationPolling"
|
||||
@@ -55,51 +54,9 @@ export function useGenerateVideo(props: UseGenerateVideoProps) {
|
||||
clearTimer()
|
||||
|
||||
try {
|
||||
// 解析分辨率:videoRatio 可能是 "9:16"(宽高比)或 "1080x1920"(分辨率)
|
||||
const ratio = props.videoRatio || "9:16"
|
||||
let outputWidth: number
|
||||
let outputHeight: number
|
||||
|
||||
if (ratio.includes(":")) {
|
||||
const [rw, rh] = ratio.split(":").map(Number)
|
||||
if (rw > 0 && rh > 0) {
|
||||
const [longSide, shortSide] = rw < rh ? [rh, rw] : [rw, rh]
|
||||
const baseLong = 1920
|
||||
const baseShort = Math.round((baseLong * shortSide) / longSide)
|
||||
const evenShort = baseShort - (baseShort % 2)
|
||||
if (rw < rh) {
|
||||
outputWidth = evenShort
|
||||
outputHeight = baseLong
|
||||
} else {
|
||||
outputWidth = baseLong
|
||||
outputHeight = evenShort
|
||||
}
|
||||
} else {
|
||||
outputWidth = 1080
|
||||
outputHeight = 1920
|
||||
}
|
||||
} else if (ratio.includes("x")) {
|
||||
const [wStr, hStr] = ratio.split("x")
|
||||
outputWidth = parseInt(wStr, 10) || 1080
|
||||
outputHeight = parseInt(hStr, 10) || 1920
|
||||
} else {
|
||||
outputWidth = 1080
|
||||
outputHeight = 1920
|
||||
}
|
||||
|
||||
// 获取后端任务 ID(预览已改为前端实时播放,不再调用后端 createPreview)
|
||||
const taskId = props.previewTaskId
|
||||
if (!taskId) {
|
||||
throw new Error("缺少预览任务 ID,无法确认生成")
|
||||
}
|
||||
|
||||
await confirmGeneration(taskId, {
|
||||
output_width: outputWidth,
|
||||
output_height: outputHeight,
|
||||
cover_url: props.coverSettings.upload_url || "",
|
||||
custom_title: props.titleSettings.title || "",
|
||||
})
|
||||
|
||||
// TODO: 替换为 createGenerationTask(POST /generation/tasks)
|
||||
// 需要后端确认新接口是否支持 cover_url / output_width / custom_title 等参数
|
||||
// 见 recent_memory/project/pending-issues.md 问题1
|
||||
startPolling()
|
||||
} catch (err: unknown) {
|
||||
console.error("[handleGenerate] 生成失败:", err)
|
||||
|
||||
Reference in New Issue
Block a user