fix: implement fixable limitations from annotation pass

cache.py — model fingerprint auto-invalidation:
  Replace hardcoded "buffalo_l_v1" version string with a fingerprint
  derived from buffalo_l .onnx file sizes and mtimes. EmbeddingCache now
  computes this at init time; stale embeddings from replaced or updated
  model files are automatically invalidated. Falls back to the static
  string before the model is downloaded.
  Note: existing caches built against the old key will miss on the first
  run after upgrade and recompute cleanly.

frigate_api.py — Frigate version check:
  Add get_frigate_version() (GET /api/version). Called at the start of
  upload_to_frigate(); warns if below v0.16 where the face training API
  endpoints don't exist.

immich_api.py + cli.py — Immich version check:
  Add get_immich_version() (GET /api/server/version). Called at startup
  before get_people(); warns if below v1.106 where the face data and
  merge APIs winnow depends on aren't guaranteed present.

Remaining TODO(frigate-api) annotations are left in place — they require
Frigate to expose per-file embeddings or a rebuild-complete signal before
they can be addressed.
This commit is contained in:
2026-06-14 18:48:07 +00:00
parent 1d44df6e96
commit 28424b0f16
5 changed files with 88 additions and 18 deletions
+12 -4
View File
@@ -17,6 +17,7 @@ from .frigate_api import (
delete_frigate_person_files,
get_all_frigate_person_files,
get_frigate_person_files,
get_frigate_version,
recognize_face,
)
from .image_processing import process_face_mode
@@ -311,10 +312,17 @@ def upload_to_frigate(jobs: list[dict]) -> None:
rprint("[yellow]⚠️ FRIGATE_URL not set, skipping upload.[/yellow]")
return
# TODO: verify Frigate version at startup (GET /api/version) and warn if
# below v0.16. The face training API (/api/faces/{name}/register,
# /api/faces/{name}/delete, /api/faces/recognize) was introduced in v0.16;
# older versions return 404s that surface as opaque upload failures.
_frigate_version = get_frigate_version()
if _frigate_version is not None:
try:
parts = [int(x) for x in _frigate_version.split("-")[0].split(".") if x.isdigit()]
if len(parts) >= 2 and (parts[0], parts[1]) < (0, 16):
rprint(
f" [yellow]⚠ Frigate {_frigate_version} detected — "
"face training API requires v0.16+. Uploads may fail.[/yellow]"
)
except Exception:
pass
rprint("\n[bold cyan]📤 Uploading to Frigate[/bold cyan]")
rprint(f" Target: [dim]{frigate_url}[/dim]")