video-accessibility/backend/app/models
Vadym Samoilenko fa351e4d25 feat: per-client glossary — hybrid exact/vector retrieval + AI injection
Adds full glossary system so Gemini uses client-approved terminology
when generating subtitles and translations (critical for 3M brand names
and product codes across 16 target locales).

Backend:
- lib/locales.py: BCP-47 locale registry, normalises xlsx fr_fr → fr-FR
- models/glossary.py: Glossary / GlossaryVersion / GlossaryTerm + enums
- services/glossary_service.py: xlsx parse (openpyxl), ingest to Mongo,
  hybrid retrieval (Aho-Corasick exact + Atlas Vector Search), prompt block
- services/embedding_service.py: Gemini text-embedding-004, batch 100, retry
- tasks/embed_glossary.py: Celery background task for async embedding
- api/v1/routes_glossaries.py: CRUD endpoints under /clients/{id}/glossaries
- gemini.py: _build_glossary_block(), {GLOSSARY} injection in all 4 call sites
- tts.py / gemini_tts.py: pass full locale codes (no split("-")[0] truncation)
- tasks/translate_and_synthesize.py: glossary lookup + injection per language
- prompts: {GLOSSARY} placeholder in ingestion, targeted, transcreation prompts
- pyproject.toml: +openpyxl, +pyahocorasick

Frontend:
- routes/admin/glossaries/: GlossaryList, GlossaryUpload, GlossaryDetail
- App.tsx: 3 new routes under /admin/clients/:clientId/glossaries
- ClientDetail.tsx: Glossaries card with count + quick links
- types/api.ts: Glossary, GlossaryVersion, GlossaryDetail, GlossaryTerm types
- lib/api.ts: 7 new API methods (upload, list, detail, terms, versions, activate, archive)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 13:03:38 +01:00
..
__pycache__ initial commit 2025-08-24 16:28:33 -05:00
audit_log.py feat: per-client glossary — hybrid exact/vector retrieval + AI injection 2026-04-29 13:03:38 +01:00
client.py fix: serialize Client/Team/Project with id not _id + guard undefined client hooks 2026-04-27 16:18:28 +01:00
glossary.py feat: per-client glossary — hybrid exact/vector retrieval + AI injection 2026-04-29 13:03:38 +01:00
invitation.py feat(saas): Phase 2 — invitation flow, email templates, MS SSO zero-membership 2026-04-27 16:52:08 +01:00
job.py feat: per-language QC workflow with linguist assignment 2026-04-29 12:09:40 +01:00
membership.py feat(saas): Phase 0+1 — Organization/Membership entities and dev branch 2026-04-27 16:46:24 +01:00
organization.py feat(saas): Phase 0+1 — Organization/Membership entities and dev branch 2026-04-27 16:46:24 +01:00
review_note.py feat: add video review with timestamped notes to Final Review 2025-12-26 15:30:00 -06:00
user.py feat: Client → Team → Project isolation system with Project Manager role 2026-04-27 15:11:13 +01:00
vtt_version.py feat: VTT version control — snapshots, diff, restore 2026-04-29 11:46:21 +01:00