feat: add multilingual glossary support (backend + frontend types)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m31s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m31s
Backend: - Add source_language column to glossaries table - Add translations JSON column to glossary_terms table - Alembic migration for schema changes - format_glossary_for_prompt now language-aware: extracts correct translation per target language, falls back to EN reference for templates with only FR→EN data - CRUD routes accept/return source_language and translations - Pydantic schemas updated Frontend: - Types updated: GlossaryTerm now has translations: Record<string, string> - Glossary/GlossaryListItem now have source_language - Added SUPPORTED_LANGUAGES constant (13 languages) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -915,10 +915,13 @@ async def _run_translation_job(
|
||||
|
||||
# Story 3.10: Retrieve and format glossary terms for LLM prompt
|
||||
glossary_terms = None
|
||||
glossary_source_lang = "fr"
|
||||
if glossary_id and user_id:
|
||||
try:
|
||||
glossary_terms = get_glossary_terms(glossary_id, user_id)
|
||||
logger.info(f"Job {job_id}: Loaded {len(glossary_terms)} glossary terms")
|
||||
glossary_data = get_glossary_terms(glossary_id, user_id)
|
||||
glossary_terms = glossary_data["terms"]
|
||||
glossary_source_lang = glossary_data.get("source_language", "fr")
|
||||
logger.info(f"Job {job_id}: Loaded {len(glossary_terms)} glossary terms (source: {glossary_source_lang})")
|
||||
except GlossaryNotFoundError as e:
|
||||
tracker.set_error(str(e))
|
||||
logger.error(f"Job {job_id}: Glossary error - {e}")
|
||||
@@ -940,7 +943,10 @@ async def _run_translation_job(
|
||||
effective_prompt = custom_prompt
|
||||
|
||||
# Build the full prompt combining effective prompt and glossary
|
||||
full_prompt = build_full_prompt(effective_prompt, glossary_terms)
|
||||
full_prompt = build_full_prompt(
|
||||
effective_prompt, glossary_terms,
|
||||
source_lang=glossary_source_lang, target_lang=target_lang,
|
||||
)
|
||||
|
||||
translation_provider = None
|
||||
_p = provider.lower()
|
||||
|
||||
Reference in New Issue
Block a user