Merge pull request 'fix: 预览功能4项优化(数量输入+并发创建+视频播放+填充修复)' (#1293) from fix/preview-improvements into develop
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m10s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m48s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m8s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 5m7s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 5m7s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 15m27s
CI/CD Pipeline / Build Staging API Image (push) Successful in 20m56s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m59s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 42s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m8s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m25s
CI/CD Pipeline / Integration Tests (push) Successful in 10m59s
CI/CD Pipeline / Unit Tests (push) Successful in 31m26s
CI/CD Pipeline / Production Browser E2E (push) Failing after 949h57m41s
CI/CD Pipeline / Deploy Production (push) Failing after 949h57m42s
CI/CD Pipeline / CI Gate (push) Failing after 949h57m43s
CI/CD Pipeline / Build Production API Image (push) Failing after 949h57m43s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 949h57m43s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 950h28m30s
CI/CD Pipeline / PR Build Web Image (push) Failing after 950h28m32s
CI/CD Pipeline / Frontend Lint (push) Failing after 950h29m10s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 950h29m14s
CI/CD Pipeline / Canary Release to Production (push) Failing after 950h31m5s
CI/CD Pipeline / Build Production Web Image (push) Failing after 950h31m6s
CI/CD Pipeline / PR Build API Image (push) Failing after 951h1m57s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m10s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m48s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m8s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 5m7s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 5m7s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 15m27s
CI/CD Pipeline / Build Staging API Image (push) Successful in 20m56s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m59s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 42s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m8s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m25s
CI/CD Pipeline / Integration Tests (push) Successful in 10m59s
CI/CD Pipeline / Unit Tests (push) Successful in 31m26s
CI/CD Pipeline / Production Browser E2E (push) Failing after 949h57m41s
CI/CD Pipeline / Deploy Production (push) Failing after 949h57m42s
CI/CD Pipeline / CI Gate (push) Failing after 949h57m43s
CI/CD Pipeline / Build Production API Image (push) Failing after 949h57m43s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 949h57m43s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 950h28m30s
CI/CD Pipeline / PR Build Web Image (push) Failing after 950h28m32s
CI/CD Pipeline / Frontend Lint (push) Failing after 950h29m10s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 950h29m14s
CI/CD Pipeline / Canary Release to Production (push) Failing after 950h31m5s
CI/CD Pipeline / Build Production Web Image (push) Failing after 950h31m6s
CI/CD Pipeline / PR Build API Image (push) Failing after 951h1m57s
This commit was merged in pull request #1293.
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
ExclamationCircleFilled,
|
||||
ClockCircleOutlined,
|
||||
} from "@ant-design/icons"
|
||||
import { InputNumber } from "antd"
|
||||
import type { PreviewItem, PreviewStatus } from "../hooks/useStep4Preview"
|
||||
|
||||
interface Step4GeneratePreviewProps {
|
||||
@@ -65,7 +66,7 @@ const Step4GeneratePreview: React.FC<Step4GeneratePreviewProps> = ({
|
||||
{isIdle && (
|
||||
<div style={{ marginBottom: 16, display: "flex", alignItems: "center", gap: 12 }}>
|
||||
<span style={{ fontSize: 14, color: "#666" }}>预览数量:</span>
|
||||
<div style={{ display: "flex", gap: 8 }}>
|
||||
<div style={{ display: "flex", gap: 8, alignItems: "center" }}>
|
||||
{PREVIEW_COUNT_OPTIONS.map((opt) => (
|
||||
<button
|
||||
key={opt.value}
|
||||
@@ -85,6 +86,15 @@ const Step4GeneratePreview: React.FC<Step4GeneratePreviewProps> = ({
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={10}
|
||||
value={previewCount}
|
||||
onChange={(val) => val && onPreviewCountChange(val)}
|
||||
style={{ width: 70 }}
|
||||
placeholder="自定义"
|
||||
/>
|
||||
<span style={{ fontSize: 12, color: "#999", marginLeft: 4 }}>(1~10)</span>
|
||||
</div>
|
||||
{previewCount > 1 && (
|
||||
<span style={{ fontSize: 12, color: "#999" }}>生成多个预览可对比不同剪辑效果</span>
|
||||
@@ -163,11 +173,15 @@ const Step4GeneratePreview: React.FC<Step4GeneratePreviewProps> = ({
|
||||
{item.status === "ready" && item.result && (
|
||||
<video
|
||||
src={item.result.videoUrl}
|
||||
controls
|
||||
autoPlay
|
||||
muted
|
||||
loop
|
||||
preload="metadata"
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
objectFit: "contain",
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -323,8 +323,8 @@ export function useStep4Preview({
|
||||
|
||||
const assetIds = materialMode === "auto" ? smartSelectedIds : selectedMaterials
|
||||
|
||||
// 并发创建所有预览任务
|
||||
for (let i = 0; i < previewCount; i++) {
|
||||
// 并发创建所有预览任务(Promise.all 并行请求,减少串行等待)
|
||||
const createTasks = Array.from({ length: previewCount }, async (_, i) => {
|
||||
try {
|
||||
const response = await createPreview({
|
||||
template_id: selectedTemplate,
|
||||
@@ -344,7 +344,8 @@ export function useStep4Preview({
|
||||
prev.map((it) => (it.index === i ? { ...it, status: "error", error: errMsg } : it)),
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
await Promise.all(createTasks)
|
||||
}, [
|
||||
selectedTemplate,
|
||||
materialTotal,
|
||||
|
||||
Reference in New Issue
Block a user