From 1dd1dca473b54007bfbd863cdb09c2a11467ee89 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Fri, 26 Jun 2026 23:12:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=9E=9A=E4=B8=BE=E5=90=8D=E5=B9=B6=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=87=8D=E5=A4=8Dworkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复 edit_plan_generator.py 中的枚举名与 editing_modes.py 保持一致: - ONE_TAKE: one-take -> one_take - VOICEOVER -> VOICE_OVER: voiceover -> voice_over 2. 更新相关文档字符串和注释 3. 删除重复的 .gitea/workflows/tests.yml (ci-cd.yml 已包含完整测试) --- .gitea/workflows/tests.yml | 113 ------------------ apps/api/app/api/routes/edit_plans.py | 6 +- apps/api/app/schemas/edit_plan.py | 6 +- .../worker_app/tasks/edit_plan_generator.py | 14 +-- 4 files changed, 13 insertions(+), 126 deletions(-) delete mode 100644 .gitea/workflows/tests.yml diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml deleted file mode 100644 index f04174dcf..000000000 --- a/.gitea/workflows/tests.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: runtime-builder:host - container: - image: localhost:5000/xiaoxia-ci-python:3.12 - - steps: - - name: Checkout code - shell: sh - run: | - set -eu - python - <<'PY' - import io - import os - import tarfile - import urllib.request - - url = f"{os.environ['GITHUB_API_URL']}/repos/{os.environ['GITHUB_REPOSITORY']}/archive/{os.environ['GITHUB_SHA']}.tar.gz" - request = urllib.request.Request(url, headers={"Authorization": f"token {os.environ['GITHUB_TOKEN']}"}) - with urllib.request.urlopen(request, timeout=120) as response: - archive = response.read() - - with tarfile.open(fileobj=io.BytesIO(archive), mode='r:gz') as tar: - root_prefix = tar.getmembers()[0].name.split('/', 1)[0] + '/' - for member in tar.getmembers(): - name = member.name - if name == root_prefix[:-1]: - continue - if name.startswith(root_prefix): - member.name = name[len(root_prefix):] - if member.name: - tar.extract(member, '.') - PY - - - name: Show Python version - shell: sh - run: | - set -eu - python --version - python -m pip --version - - - name: Install dependencies - shell: sh - run: | - set -eu - python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com - python -m pip install -r requirements.txt -r requirements-dev.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com - - - name: Run tests - shell: sh - run: | - set -eu - PYTHONPATH="$PWD/apps/api:$PWD" python -m pytest tests/unit -q - - lint: - runs-on: runtime-builder:host - container: - image: localhost:5000/xiaoxia-ci-python:3.12 - - steps: - - name: Checkout code - shell: sh - run: | - set -eu - python - <<'PY' - import io - import os - import tarfile - import urllib.request - - url = f"{os.environ['GITHUB_API_URL']}/repos/{os.environ['GITHUB_REPOSITORY']}/archive/{os.environ['GITHUB_SHA']}.tar.gz" - request = urllib.request.Request(url, headers={"Authorization": f"token {os.environ['GITHUB_TOKEN']}"}) - with urllib.request.urlopen(request, timeout=120) as response: - archive = response.read() - - with tarfile.open(fileobj=io.BytesIO(archive), mode='r:gz') as tar: - root_prefix = tar.getmembers()[0].name.split('/', 1)[0] + '/' - for member in tar.getmembers(): - name = member.name - if name == root_prefix[:-1]: - continue - if name.startswith(root_prefix): - member.name = name[len(root_prefix):] - if member.name: - tar.extract(member, '.') - PY - - - name: Install dependencies - shell: sh - run: | - set -eu - python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com - python -m pip install -r requirements.txt -r requirements-dev.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com - - - name: Run Black (check only) - shell: sh - run: | - set -eu - python -m black --check alembic apps packages tests scripts - - - name: Run Flake8 - shell: sh - run: | - set -eu - python -m flake8 apps packages tests --count --statistics diff --git a/apps/api/app/api/routes/edit_plans.py b/apps/api/app/api/routes/edit_plans.py index 41092a33a..3240ca8ae 100644 --- a/apps/api/app/api/routes/edit_plans.py +++ b/apps/api/app/api/routes/edit_plans.py @@ -205,10 +205,10 @@ def auto_generate_edit_plan( 根据素材的分类结果和质量评分,自动编排剪辑计划。 支持多种剪辑模式: - - one-take: 按分类分组,组内按质量排序,顺序拼接 + - one_take: 按分类分组,组内按质量排序,顺序拼接 - pip: 第一个高质量素材为主画面,其余为画中画 - - voiceover: person 类素材为主播口播,其余穿插为 B-roll - - voice_pip: 结合 voiceover 和 pip,第一个高质量 person 素材为主画面 + - voice_over: person 类素材为主播口播,其余穿插为 B-roll + - voice_pip: 结合 voice_over 和 pip,第一个高质量 person 素材为主画面 """ _ensure_project( project_id, request.workspace_id, authenticated_user, project_repository, workspace_member_repository diff --git a/apps/api/app/schemas/edit_plan.py b/apps/api/app/schemas/edit_plan.py index 1d3c07571..5196120b3 100644 --- a/apps/api/app/schemas/edit_plan.py +++ b/apps/api/app/schemas/edit_plan.py @@ -35,7 +35,7 @@ class EditPlanResponse(BaseModel): title_id: str = "" status: str summary: str - editing_mode: str | None = None # one-take, pip, voiceover, voice_pip + editing_mode: str | None = None # one_take, pip, voice_over, voice_pip clips: list[EditPlanClipResponse] = Field(default_factory=list) created_at: datetime | None = None updated_at: datetime | None = None @@ -53,8 +53,8 @@ class AutoGenerateEditPlanRequest(BaseModel): workspace_id: str asset_library_id: str editing_mode: str = Field( - default="one-take", - description="剪辑模式: one-take, pip, voiceover, voice_pip" + default="one_take", + description="剪辑模式: one_take, pip, voice_over, voice_pip" ) target_duration: float = Field( default=30.0, diff --git a/apps/worker/worker_app/tasks/edit_plan_generator.py b/apps/worker/worker_app/tasks/edit_plan_generator.py index 3634d8fd3..d8b5848b8 100644 --- a/apps/worker/worker_app/tasks/edit_plan_generator.py +++ b/apps/worker/worker_app/tasks/edit_plan_generator.py @@ -14,9 +14,9 @@ logger = logging.getLogger(__name__) class EditingMode(StrEnum): """剪辑模式枚举""" - ONE_TAKE = "one-take" # 顺序拼接模式 + ONE_TAKE = "one_take" # 顺序拼接模式 PIP = "pip" # 画中画模式 - VOICEOVER = "voiceover" # 口播+B-roll模式 + VOICE_OVER = "voice_over" # 口播+B-roll模式 VOICE_PIP = "voice_pip" # 口播+画中画组合模式 @@ -63,7 +63,7 @@ class SmartEditPlanGenerator: 智能剪辑计划生成器 根据素材的分类结果和质量评分,自动编排剪辑计划。 - 支持多种剪辑模式:one-take, pip, voiceover, voice_pip + 支持多种剪辑模式:one_take, pip, voice_over, voice_pip """ def __init__(self, project_id: str, assets: list[Asset]): @@ -278,7 +278,7 @@ class SmartEditPlanGenerator: _calculate_start_times(clips) return EditPlanResult( project_id=self.project_id, - editing_mode=EditingMode.VOICEOVER, + editing_mode=EditingMode.VOICE_OVER, clips=clips, total_duration=total_duration, summary=f"Voiceover 模式:{person_count} 段口播 + {len(clips) - person_count} 段 B-roll" @@ -347,14 +347,14 @@ class SmartEditPlanGenerator: def generate_plan( self, - editing_mode: str = "one-take", + editing_mode: str = "one_take", target_duration: float = 30.0 ) -> EditPlanResult: """ 生成剪辑计划 Args: - editing_mode: 剪辑模式 (one-take/pip/voiceover/voice_pip) + editing_mode: 剪辑模式 (one_take/pip/voice_over/voice_pip) target_duration: 目标时长(秒) Returns: @@ -378,7 +378,7 @@ class SmartEditPlanGenerator: return self._generate_one_take(target_duration) elif mode == EditingMode.PIP: return self._generate_pip(target_duration) - elif mode == EditingMode.VOICEOVER: + elif mode == EditingMode.VOICE_OVER: return self._generate_voiceover(target_duration) elif mode == EditingMode.VOICE_PIP: return self._generate_voice_pip(target_duration) -- 2.54.0