From 9ddcb2347dce5d6e889d03c46ddb93dc9a8db855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B1=BC=E5=BC=80=E5=8F=91?= Date: Tue, 19 May 2026 15:17:36 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20-=20test=E7=8E=AF=E5=A2=83=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A/=E5=B9=B3=E5=8F=B0=E9=80=89=E6=8B=A9/=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0/?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - VITE_API_BASE_URL 固定为 dev.tapi.meijiaka.cn(test环境) - 添加 platform 选择(all/macos/windows),支持单独构建 - 添加版本号自动更新(tauri.conf.json + Cargo.toml) - 添加 Rust + Node 构建缓存,节省CI额度 - 修复 ViduAdapter parse_callback 运算符优先级bug - 修复 ViduProvider tts_sync 日志前缀误写 - VoiceSynthesis 空状态UI优化 --- .github/workflows/release.yml | 70 +++++++++++++++++-- python-api/app/ai/adapters/vidu_adapter.py | 2 +- python-api/app/ai/providers/vidu_provider.py | 2 +- .../pages/VideoCreation/VoiceSynthesis.css | 22 ++++-- .../pages/VideoCreation/VoiceSynthesis.tsx | 15 +++- 5 files changed, 97 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6a8d20..0fbb51f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,18 +10,20 @@ on: description: '版本号 (例如 1.5.16)' required: true type: string - environment: - description: '构建环境' + platform: + description: '构建平台' required: true type: choice options: - - test - - prod - default: test + - all + - macos + - windows + default: all jobs: build-macos: name: Build macOS (Universal) + if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'macos' }} runs-on: macos-latest steps: - name: Checkout @@ -37,6 +39,21 @@ jobs: with: targets: x86_64-apple-darwin,aarch64-apple-darwin + - name: Cache Rust dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + tauri-app/src-tauri/target + key: ${{ runner.os }}-cargo-${{ hashFiles('tauri-app/src-tauri/Cargo.lock') }} + + - name: Cache Node dependencies + uses: actions/cache@v4 + with: + path: tauri-app/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('tauri-app/package-lock.json') }} + - name: Download sidecar binaries run: | mkdir -p tauri-app/src-tauri/binaries @@ -62,11 +79,22 @@ jobs: working-directory: tauri-app run: npm ci + - name: Update version + run: | + if [ -n "${{ inputs.version }}" ]; then + VERSION="${{ inputs.version }}" + else + VERSION="${GITHUB_REF_NAME#v}" + fi + perl -pi -e "s/\"version\"\s*:\s*\"[^\"]*\"/\"version\": \"$VERSION\"/" tauri-app/src-tauri/tauri.conf.json + perl -pi -e "s/^version = \"[^\"]*\"/version = \"$VERSION\"/" tauri-app/src-tauri/Cargo.toml + echo "Version updated to: $VERSION" + - name: Build macOS Universal working-directory: tauri-app run: npm run tauri -- build --target universal-apple-darwin env: - VITE_API_BASE_URL: ${{ inputs.environment == 'prod' && 'https://tapi.meijiaka.cn/api/v1' || 'https://dev.tapi.meijiaka.cn/api/v1' }} + VITE_API_BASE_URL: https://dev.tapi.meijiaka.cn/api/v1 TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} @@ -80,6 +108,7 @@ jobs: build-windows: name: Build Windows (x64) + if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'windows' }} runs-on: windows-latest steps: - name: Checkout @@ -95,6 +124,21 @@ jobs: with: targets: x86_64-pc-windows-msvc + - name: Cache Rust dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + tauri-app/src-tauri/target + key: ${{ runner.os }}-cargo-${{ hashFiles('tauri-app/src-tauri/Cargo.lock') }} + + - name: Cache Node dependencies + uses: actions/cache@v4 + with: + path: tauri-app/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('tauri-app/package-lock.json') }} + - name: Download sidecar binaries shell: pwsh run: | @@ -108,12 +152,24 @@ jobs: working-directory: tauri-app run: npm ci + - name: Update version + shell: pwsh + run: | + $version = if ("${{ inputs.version }}") { "${{ inputs.version }}" } else { $env:GITHUB_REF_NAME -replace '^v', '' } + $content = Get-Content tauri-app/src-tauri/tauri.conf.json -Raw + $content = $content -replace '"version"\s*:\s*"[^"]*"', "`"version`": `"$version`"" + Set-Content tauri-app/src-tauri/tauri.conf.json -Value $content + $cargo = Get-Content tauri-app/src-tauri/Cargo.toml -Raw + $cargo = $cargo -replace '^version = "[^"]*"', "version = `"$version`"" + Set-Content tauri-app/src-tauri/Cargo.toml -Value $cargo + Write-Host "Version updated to: $version" + - name: Build Windows x64 working-directory: tauri-app shell: pwsh run: npm run tauri -- build --target x86_64-pc-windows-msvc env: - VITE_API_BASE_URL: ${{ inputs.environment == 'prod' && 'https://tapi.meijiaka.cn/api/v1' || 'https://dev.tapi.meijiaka.cn/api/v1' }} + VITE_API_BASE_URL: https://dev.tapi.meijiaka.cn/api/v1 TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} diff --git a/python-api/app/ai/adapters/vidu_adapter.py b/python-api/app/ai/adapters/vidu_adapter.py index 91acda3..5bbd32c 100644 --- a/python-api/app/ai/adapters/vidu_adapter.py +++ b/python-api/app/ai/adapters/vidu_adapter.py @@ -289,5 +289,5 @@ class ViduAdapter(PlatformAdapter, SyncCapable, TaskCapable, CallbackCapable): return TaskStatus( state=self.normalize_state(state), result={"video_url": video_url, "creations": creations, "task_id": task_id} if video_url else {"task_id": task_id}, - error_message=data.get("err_code") or data.get("message") if state == "failed" else None, + error_message=(data.get("err_code") or data.get("message")) if state == "failed" else None, ) diff --git a/python-api/app/ai/providers/vidu_provider.py b/python-api/app/ai/providers/vidu_provider.py index 2c189c0..f9d831c 100644 --- a/python-api/app/ai/providers/vidu_provider.py +++ b/python-api/app/ai/providers/vidu_provider.py @@ -128,7 +128,7 @@ class ViduProvider: logger.info(f"[Vidu TTS] 请求参数: text_length={len(text)}") - logger.info(f"[Vidu LipSync] 提交请求: url={url}, body={body}") + logger.info(f"[Vidu TTS] 提交请求: url={url}, body={body}") try: resp = await self.client.post(url, json=body) diff --git a/tauri-app/src/pages/VideoCreation/VoiceSynthesis.css b/tauri-app/src/pages/VideoCreation/VoiceSynthesis.css index 2cdf7fd..80fd699 100644 --- a/tauri-app/src/pages/VideoCreation/VoiceSynthesis.css +++ b/tauri-app/src/pages/VideoCreation/VoiceSynthesis.css @@ -211,16 +211,30 @@ /* 空状态 */ .voice-empty { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: var(--spacing-sm); padding: var(--spacing-xl); text-align: center; - color: var(--text-secondary); - font-size: var(--font-sm); margin: auto; } -.voice-empty small { +.voice-empty-title { + font-size: var(--font-sm); + font-weight: 500; + color: var(--text-secondary); +} + +.voice-empty-desc { font-size: var(--font-xs); - opacity: 0.7; + color: var(--text-tertiary); +} + +.voice-empty-action { + margin-top: 4px; + font-size: var(--font-sm); } /* 语速 */ diff --git a/tauri-app/src/pages/VideoCreation/VoiceSynthesis.tsx b/tauri-app/src/pages/VideoCreation/VoiceSynthesis.tsx index c274832..6ddee5d 100644 --- a/tauri-app/src/pages/VideoCreation/VoiceSynthesis.tsx +++ b/tauri-app/src/pages/VideoCreation/VoiceSynthesis.tsx @@ -15,6 +15,7 @@ import { toast } from '../../store/uiStore'; import type { AlignmentResult } from '../../api/types'; import { useProgressStore } from '../../store/progressStore'; import { usePointsCheck } from '../../hooks/usePointsCheck'; +import { useNavigation } from '../../contexts/NavigationContext'; import { getFriendlyErrorMessage } from '../../utils/errorMessage'; import { createTask, getTaskStatus } from '../../api/modules/task'; import { matchSegmentsToUtterances } from '../../utils/audioAlign'; @@ -385,6 +386,12 @@ export default function VoiceSynthesis() { } }, [projectId, segments, handleAlignAndClip, checkBalance, handleError, estimatedTtsPoints]); + const { navigate } = useNavigation(); + + const handleGoToVoiceClone = useCallback(() => { + navigate('voice-material'); + }, [navigate]); + const handleToggleGeneratedAudio = useCallback(() => { if (!dubbingAudioUrl) {return;} @@ -452,7 +459,13 @@ export default function VoiceSynthesis() { {activeVoiceTab === 'clone' && (
{voiceMaterials.filter(m => m.status === 'ready').length === 0 ? ( -
暂无私有音色
去素材库上传音频并克隆音色
+
+
还没有私有音色
+
上传一段音频,即可克隆你的专属音色
+ +
) : ( voiceMaterials.filter(m => m.status === 'ready').map(m => (
{ setSelectedVoiceId(m.voiceId); saveMetaToLocalFile({ selectedVoiceId: m.voiceId }); }}>