Skip to content

Person 3: multilingual translation layer with tests and pipeline inte… - #198

Open
ayushunhale10-code wants to merge 2 commits into
vicharanashala:mainfrom
kshethragna-mikkineni:dev/faq-portal-updates/voicefaq-multilingual
Open

ayushunhale10-code wants to merge 2 commits into
vicharanashala:mainfrom
kshethragna-mikkineni:dev/faq-portal-updates/voicefaq-multilingual

Conversation

@ayushunhale10-code

Copy link
Copy Markdown

What changed

Implemented the multilingual translation layer (Person 3) for the voice FAQ feature:

  • translateToEnglish(text) — translates any input text to English via AiClient, returns original if already English
  • translateFromEnglish(text, targetLang) — translates English text into a target language
  • detectLanguage(text) — identifies input language, falls back to English on failure
  • processMultilingualQuery(text) — main pipeline entry point returning { translatedText, detectedLanguage, isEnglish }
  • All functions have safe fallback to English on any AI/network failure
  • Integrated into rag.service.ts (Ask AI/RAG pipeline) and search.controller.ts (standard FAQ search)

Related issue

Type of change

  • Bug fix
  • Feature
  • Refactor (no behaviour change)
  • Docs / comments only
  • CI / tooling

Area affected

  • Backend (Express / Mongoose)
  • Frontend (React / Vite)
  • Admin / Train tab (/admin/*)
  • Community (/community — posts, comments, auto-answer)
  • Search (hybrid text retrieval, training stats)
  • Auth / middleware / samagama.in bridge
  • Crons / schedulers / embedding-warm
  • Observability (Sentry / logging / Discord alerts)
  • Docs

CI verification

  • cd apps/backend && npx tsc --noEmit exits 0
  • cd apps/backend && npx vitest run — all tests pass
  • cd apps/frontend && npx tsc --noEmit exits 0
  • cd apps/frontend && npx vitest run — all tests pass
  • pnpm run lint — 0 errors (152 warnings is the baseline)
  • GitHub Actions green on the merge commit (CI, CodeQL, Build & Deploy)
  • Tested with a real API hit or browser interaction if behaviour changed
  • Tests added or updated for the change
  • Single logical change — unrelated fixes noted in description, not fixed here
  • Docs updated if route / API / env var / pipeline behaviour changed
  • Rebased onto main, no merge commits

Notes for reviewer

Feature type 'translation' was added to AiClient's AIFeature union to support this. 11/11 unit tests passing in multilingual.service.test.ts (mocked AI responses — no live API calls in tests). Ready for integration with Person 5's pipeline.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant