fix: constrain subtitle AI to preserve timestamps
This commit is contained in:
1 parent
5ff72bf1b6
commit
ae4791143c
2 files changed
+19
-2
No files matched your search
@@ -6,7 +6,11 @@ from .subtitle_tools import build_vtt, clean_english_subtitle
|
||||
TRANSLATION_SYSTEM_PROMPT = """
|
||||
你是英语学习产品的字幕翻译助手。输入是按顺序排列的英文字幕。
|
||||
请只返回 JSON,格式为 {"translations":[{"index":1,"zh":"中文翻译"}]}。
|
||||
要求:中文自然,适合英语学习;不要增删字幕条数;不要解释。
|
||||
要求:
|
||||
1. 只翻译英文文本,不要改写原文含义。
|
||||
2. 不要修改时间轴,不要生成任何 start/end/time 字段。
|
||||
3. 不要增删字幕条数,每个 index 必须返回一条中文。
|
||||
4. 中文自然,适合英语学习;不要解释。
|
||||
""".strip()
|
||||
|
||||
|
||||
@@ -45,5 +49,6 @@ def process_subtitles_with_ai(english_content: str, client) -> dict[str, object]
|
||||
"empty_count": cleaned.empty_count,
|
||||
"translation_count": len(zh_cues),
|
||||
"timestamp_calibrated": False,
|
||||
"timestamp_note": "AI 仅翻译文本,中文字幕时间轴从英文字幕原样复制。",
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user