Building Ask Leya: Lessons Learned from Local ONNX Embeddings, Prisma Migrations, and Express Async Handlers
Description and use
Built a chat widget using local ONNX embeddings for multilingual retrieval, streamlined Prisma migrations, and robust async error handling in Express.
Problem
Need a chat widget that answers from a business’s own content, supports multiple languages locally, handles database migrations with unreleased modules, and properly forwards async errors in Express.
Outcome
The project achieved a multilingual, locally hosted chat widget with efficient embeddings, streamlined migrations, and robust async error handling, reducing external dependencies and improving response reliability.
Workflow
- 1. Load paraphrase-multilingual-MiniLM-L12-v2 ONNX model in-process for vector embeddings.
- 2. Embed user query and match against English knowledge base using pgvector.
- 3. Return answer in user language via chat model.
- 4. Use prisma migrate diff to filter additive statements for unreleased tables.
- 5. Add Express error-handling middleware to catch async rejections and send responses.
Evidence
Cross-language retrieval is local, not the LLM Retrieval uses paraphrase-multilingual-MiniLM-L12-v2 through ONNX, in-process — 384 dims, trained across 50+ languages.
Express 4 doesn't forward async rejections
- Record date: 2026-09-15T02:46:53.673Z