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
@@ -8,9 +8,17 @@ from backend.subtitle_ai import process_subtitles_with_ai
|
||||
|
||||
class FakeClient:
|
||||
def chat_json(self, system_prompt, user_payload):
|
||||
assert "不要修改时间轴" in system_prompt
|
||||
assert "start" not in user_payload["cues"][0]
|
||||
assert "end" not in user_payload["cues"][0]
|
||||
return {
|
||||
"translations": [
|
||||
{"index": 1, "zh": "我第一次做投资人是在 24 岁。"}
|
||||
{
|
||||
"index": 1,
|
||||
"start": "00:00:99.000",
|
||||
"end": "00:00:99.999",
|
||||
"zh": "我第一次做投资人是在 24 岁。",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,6 +39,10 @@ My first job as an investor was when I was 24 years old,
|
||||
assert "我第一次做投资人是在 24 岁。" in result["subtitle_zh_content"]
|
||||
assert result["report"]["duplicate_count"] == 1
|
||||
assert result["report"]["translation_count"] == 1
|
||||
assert "00:00:00.872 --> 00:00:04.959" in result["subtitle_en_content"]
|
||||
assert "00:00:00.872 --> 00:00:04.959" in result["subtitle_zh_content"]
|
||||
assert "timestamp_calibrated" in result["report"]
|
||||
assert result["report"]["timestamp_calibrated"] is False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user