fix: preserve upload recovery and harden speech indexing

This commit is contained in:
2026-08-12 19:49:25 +08:00
parent 10f2c078ec
commit a0a185b96c
16 changed files with 13234 additions and 62 deletions
+23
View File
@@ -16,9 +16,32 @@ from imagefind.jobs import JobRetry
from imagefind.main import create_app
from imagefind.media import MediaInput
from imagefind.speech import SPEECH_INDEX_REVISION, SpeechService, SpeechStageError
from imagefind.speech_quality import aggregate_transcript_quality
from imagefind.text import fts_query
def test_ending_hallucination_is_risky_twice_or_once_in_weak_speech():
repeated = aggregate_transcript_quality([
{"text": "拜拜"},
{"text": "正常对话"},
{"text": "拜拜"},
])
assert "whole_ending_hallucination" in repeated.flags
assert ("拜拜", 2) in repeated.repeated_phrases
weak = aggregate_transcript_quality([
{"text": "谢谢大家收看", "speech_ratio": 0.1},
{"text": "正常对话", "speech_ratio": 0.8},
])
assert "whole_ending_hallucination" in weak.flags
single = aggregate_transcript_quality([
{"text": "拜拜", "speech_ratio": 0.8},
{"text": "正常对话", "speech_ratio": 0.8},
])
assert "whole_ending_hallucination" not in single.flags
def _app(tmp_path: Path):
settings = Settings(data_dir=tmp_path / "data", embedding_backend="hash", upload_reserve_gb=0)
settings.prepare()