Resume captions against the saved route-specific model

This commit is contained in:
Sleeps
2026-10-07 12:38:09 +01:00
parent e6fe199454
commit d7380b2870
+13 -8
View File
@@ -194,18 +194,23 @@ def _select_caption_rows(
params: list[object] = [] params: list[object] = []
if only_needing_caption and not getattr(args, "force", False): if only_needing_caption and not getattr(args, "force", False):
expected_models = [ conditions.append(
"("
"f.caption IS NULL OR f.caption_model IS NULL "
"OR f.caption_route IS NULL "
"OR f.caption_route NOT IN ('general', 'specialist') "
"OR (f.caption_route = 'general' AND f.caption_model != ?) "
"OR (f.caption_route = 'specialist' AND f.caption_model != ?) "
"OR f.route_policy IS NULL OR f.route_policy != ?"
")"
)
params.extend(
[
settings.caption_general_model, settings.caption_general_model,
settings.caption_specialist_model, settings.caption_specialist_model,
_route_policy(),
] ]
placeholders = ",".join("?" for _ in expected_models)
conditions.append(
f"(f.caption IS NULL OR f.caption_model IS NULL "
f"OR f.caption_model NOT IN ({placeholders}) "
f"OR f.route_policy IS NULL OR f.route_policy != ?)"
) )
params.extend(expected_models)
params.append(_route_policy())
if getattr(args, "media_id", None): if getattr(args, "media_id", None):
conditions.append("f.media_id = ?") conditions.append("f.media_id = ?")