Files
vrsub/pyproject.toml
T
cat-shark 5c12bbcb74 fix: 翻译批内行数错位(内容-时间错位)+ system_prompt 元组 bug
根因(真实任务 run_51242078d76e):
1. LLM 按 CHUNK_SIZE=20 分批翻译时,对语义碎片句(如单独的助词/名词/
   语气词)偶发多拆/少拆一行,translate_lines 无条件 extend 导致:
   - 多行 -> 后续所有字幕文本整体错位,时间戳从原文复制、文本却错贴时间;
   - 少行 -> invoke 末尾补空导致该条内容缺失。
   程序按时戳看不出问题,实际"内容对错时间"(如第756条"好像喜欢害羞
   的样子"错贴 3805s,实为"恥ずかしいのが好きみたいなので"的译文)。
2. system_prompt 圆括号内出现 f-string 赋值导致隐式字符串拼接失效,
   整体变成 tuple,json 序列化后 content 是数组 -> LLM API 400。

修复:
- 提示词强化:逐行独立翻译 + 碎片句按语境独立成行 + 禁止合并/拆分;
- _repair_batch:多行末尾合并到前一行、少行重试该批(最多3次)仍不足
  补空串占位(宁缺勿错位),保证译文与原文逐条时间对齐;
- system_prompt 显式 + 拼接为单个字符串。

测试(先红后绿):
- test_translate_lines_aligns_extra_line:多行合并对齐
- test_translate_lines_aligns_missing_line:少行重试补齐
- test_translate_lines_pads_after_retries_exhausted:重试耗尽补空
- test_pipeline_zh_cn_timetext_alignment:真实 LLM 完整 1440 行逐条对齐
pyproject.toml: 注册 integration marker
2026-09-05 19:36:47 +08:00

46 lines
1.5 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[project]
name = "vrsub"
version = "0.1.0"
description = "VRSub:为视频生成 VR 双眼字幕的单体应用(API、调度器与全部节点在单进程内运行)"
requires-python = ">=3.11"
dependencies = [
# Web 框架:FastAPI 负责 API 与静态前端挂载。
"fastapi",
"uvicorn",
"python-multipart",
# 转写节点:faster-whisper 及其 CUDA 动态库(同进程直接加载,无需路径注入)。
"faster-whisper>=1.2.1",
"nvidia-cublas-cu12>=12.9.2.10",
"nvidia-cudnn-cu12>=9.24.0.43",
# 提音节点:imageio-ffmpeg 提供内置 ffmpeg 兜底。
"imageio-ffmpeg>=0.6",
"python-dotenv>=1.2.2",
]
[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"httpx",
]
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
# wov_sdk / wov_app 位于 src/nodes 位于仓库根,一并作为可安装包。
[tool.setuptools.packages.find]
where = ["src", "."]
include = ["wov_sdk*", "wov_app*", "nodes*"]
# pytest 配置:扫描 tests 目录并强制 100% 行覆盖率;同时把仓库根加入
# sys.path,保证 nodes 包在未重新安装时也能被导入。
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["."]
addopts = "--cov=src --cov=nodes --cov-fail-under=100 -p no:cacheprovider"
# 集成测试标记(真实模型/真实 LLM/真实数据,默认随全套执行,缺数据自动跳过)。
markers = [
"integration: 需要真实模型/真实音频/真实 LLM API 或用户提供的真实数据,数据或环境缺失时跳过",
]