style: auto-format with black + isort + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 29s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled

This commit is contained in:
CI Bot
2026-09-08 02:36:00 +00:00
parent acac17d8f2
commit 569e5aa3dc
2 changed files with 15 additions and 8 deletions
+9 -3
View File
@@ -90,6 +90,7 @@ def adapt_template_length(template: list[int], clip_count: int) -> list[int]:
result.append(template[i % len(template)])
return result
def transition_overlap_seconds(transition_effect: Optional[str], transition_duration: float) -> float:
"""转场导致的相邻片段重叠时长。
@@ -201,8 +202,10 @@ def plan_clip_durations(
result[i] = round(max_dur, 3)
# 将多余时长分配给最短的未超限片段
candidates = [
j for j in range(len(result))
if j != i and (
j
for j in range(len(result))
if j != i
and (
not asset_durations
or j >= len(asset_durations)
or result[j] < float(asset_durations[j]) * 0.9
@@ -227,7 +230,10 @@ def plan_clip_durations(
if deviation > TOTAL_DURATION_TOLERANCE:
logger.warning(
"#1768 时长总和误差 %.3fs 超过阈值 %.1fsvoice=%.2fs, net=%.2fs),末段补偿修正",
deviation, TOTAL_DURATION_TOLERANCE, voice, net_total,
deviation,
TOTAL_DURATION_TOLERANCE,
voice,
net_total,
)
# 修正末段使净时长回归配音时长
result[-1] = round(result[-1] + (voice - net_total), 3)
@@ -11,6 +11,7 @@
from __future__ import annotations
import math
import pytest
from packages.domain.voice_duration_planner import (
@@ -23,7 +24,6 @@ from packages.domain.voice_duration_planner import (
total_output_duration,
)
# ── 模板池 ──────────────────────────────────────────────────────────────────
@@ -268,9 +268,9 @@ class TestTotalDurationTolerance:
adapted = adapt_template_length(tpl, 5)
result = plan_clip_durations(5, 30.0, rhythm_template=adapted)
net = total_output_duration(result)
assert abs(net - 30.0) <= TOTAL_DURATION_TOLERANCE, (
f"模板 {tpl} 总时长误差 {abs(net - 30.0):.3f}s > {TOTAL_DURATION_TOLERANCE}s"
)
assert (
abs(net - 30.0) <= TOTAL_DURATION_TOLERANCE
), f"模板 {tpl} 总时长误差 {abs(net - 30.0):.3f}s > {TOTAL_DURATION_TOLERANCE}s"
# ── #1768 组合场景 ──────────────────────────────────────────────────────────
@@ -287,7 +287,8 @@ class TestCombinedScenarios:
adapted = adapt_template_length(tpl, 5)
result = plan_clip_durations(
5, voice,
5,
voice,
transition_effects=effects,
transition_durations=tdurs,
rhythm_template=adapted,