auto-save 2026-05-14 11:04 (~6)

This commit is contained in:
2026-05-14 11:05:01 +08:00
parent 3aceb221ac
commit 7393fdbfa2
6 changed files with 64 additions and 41 deletions

View File

@@ -10,13 +10,15 @@ python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # 按需填 LLM_API_KEY / MINIMAX_API_KEY
uvicorn main:app --port 4291 --reload
uvicorn main:app --host 127.0.0.1 --port 4291
```
不要在长下载、抽帧、音频处理时带 `--reload` 跑后端reload 会等待后台任务结束,表现为端口还在但新请求卡住。
## 路由
- `GET /health` — 健康检查 + 配置状态
- `POST /jobs` `{url}` — 创建 job后台下载/拆轨/抽帧
- `POST /jobs` `{url}` — 创建 job后台下载源视频,视频就绪后可手动解析或提取音频
- `GET /jobs/{id}` — 当前状态 + 产物
- `POST /jobs/{id}/transcribe` — 触发音频提取 + ASR + 翻译 + SKG 文案改写;配置 MiniMax 后生成配音。前端 Audio 节点提供“提取音频 / 重新提取音频”按钮,不依赖抽帧完成
- `GET /jobs/{id}/video.mp4` — 原视频

View File

@@ -1155,7 +1155,7 @@ def ffprobe_meta(mp4: Path) -> dict:
def pipeline_download(job_id: str) -> None:
"""阶段 1仅下载或上传跳过落 source.mp4停在 downloaded 等用户点解析。"""
"""阶段 1仅下载或上传跳过落 source.mp4停在 downloaded 等用户点解析/提取音频"""
job = JOBS[job_id]
d = job_dir(job_id)
try:
@@ -1567,7 +1567,7 @@ async def pipeline_transcribe(job_id: str) -> None:
mp4 = d / "source.mp4"
if not mp4.exists():
raise RuntimeError("source.mp4 不存在,视频导入完成后再提取音频")
update(job, status="transcribing", message="ffmpeg 提取音频轨…", progress=max(job.progress, 45), error="")
update(job, status="transcribing", message="ffmpeg 提取音频轨…", progress=max(45, min(job.progress, 70)), error="")
run([
"ffmpeg", "-y", "-i", str(mp4),
"-vn", "-ac", "1", "-ar", "16000", "-c:a", "pcm_s16le",
@@ -2020,7 +2020,7 @@ async def trigger_transcribe(job_id: str, bg: BackgroundTasks) -> Job:
raise HTTPException(409, f"video not ready, got {job.status}")
if job.status in {"splitting", "transcribing"} or job.audio_script.status == "rewriting":
raise HTTPException(409, f"job is busy, got {job.status}")
update(job, status="transcribing", progress=max(job.progress, 45), error="", message="准备提取音频…")
update(job, status="transcribing", progress=max(45, min(job.progress, 70)), error="", message="准备提取音频…")
bg.add_task(pipeline_transcribe, job_id)
return job