SoalFlow
Teams upload their documents and embed a chat widget that answers only from them.

The problem
Soal is Malay for “question”. SoalFlow lets a team turn its own PDF and Word documents into an AI chat widget for its website. The people using it are business owners and support staff, not machine-learning engineers, so no screen can assume they know what retrieval or embeddings are.
The whole product rests on one promise: the bot answers strictly from the team’s own documents, cites them, and says it doesn’t know when nothing relevant is found. A bot that wanders outside the knowledge base breaks that promise, and so does one team ever seeing another team’s data.
What I built
- Dashboard. Upload documents and watch them move through ingestion, configure each bot, test it in a playground, copy the embed snippet, set allowed domains, a greeting and a theme, and review real visitor conversations.
- Widget. One
scripttag on any website renders a chat bubble that streams answers token by token. The playground and the widget share the same chat window component, so what a team tests is what visitors get. - Knowledge gaps. Questions the bot couldn’t answer are collected, grouped by meaning and shown to the team as a ranked list, with a weekly email digest teams can turn off.
- Platform admin. Teams, users, plans and limits, usage reporting, and per-team bring-your-own-key for AI providers.
Architecture & stack
A single Laravel 13 app with an Inertia 3, React 19 and TypeScript dashboard, built from the starter kit with Teams, where each team is a tenant. The RAG engine is the Laravel AI SDK with PostgreSQL and pgvector as the vector store.
Ingestion is a queued job: extract text with smalot/pdfparser or PHPWord, split it into overlapping chunks, embed each chunk, and store it with its team, document and page. Each document is pending, processing, ready, or failed with a reason the dashboard shows. Answering embeds the question, runs a vector search scoped to the team and bot with a minimum similarity threshold, and hands only the retrieved chunks to the model, whose instructions require grounding, citations and an honest “I don’t know”.
No application code names a concrete AI provider. Generation and embeddings go through a resolver that picks the team’s own key when it has one and the platform setting otherwise.
Highlights
- Isolation that fails closed. Every tenant model carries
team_idbehind a global scope that matches nothing when there is no authenticated team. A dedicated test suite proves one team can’t read another’s chunks, conversations or gaps. - A widget that can’t be borrowed. The widget renders inside a shadow DOM, so it can’t break the host page’s CSS or be broken by it. It uses a public key only; the server checks the key and the
Originheader against the bot’s allowed domains and rate-limits per key and IP. - Swappable models. The answering model can change at any time with no data change. Each chunk records the embedding model and dimensions it was made with, and a re-index job re-embeds a team’s chunks when the embedding model changes.
- Gaps that close themselves. When retrieval finds nothing above the threshold, the question and the query vector already computed are stored instead of thrown away. A queued job clusters them by meaning at no extra AI cost, and gaps resolve on their own once a new document answers them.