Task
Companies with price lists, delivery rules and recurring questions need a consultant that helps customers find the terms and proceed to an order. Missing information should lead to a manager hand-off with context.
I built a demonstration project for the fictional Kolosok bakery. One engine serves a website widget and a Telegram bot. This is an open project with a working service, rather than a real client deployment story.
Solution
Customers ask about terms, receive an answer and expand the price-list or FAQ fragment used. Questions with insufficient similarity are declined before reaching the model. Otherwise GigaChat receives matching fragments and instructions to answer from them or decline. If the provider is unavailable, the service shows a suitable fragment without generation.
For human help, the consultant collects a name, phone and question. In production mode it saves the enquiry to PostgreSQL before notifying the manager in Telegram with conversation context. The public demo only previews the message using fictional contacts. Questions and matching fragments are sent to the model provider; contacts entered in the enquiry form are excluded from its context.
What was done
- Combined prices, delivery rules and FAQs into one knowledge base for the widget and Telegram bot
- Connected GigaChat and expandable sources so customers can check prices and terms
- Added refusal when information is missing and a manager enquiry form
- Enabled TXT, Markdown and PDF uploads for questions about a visitor's document
- Separated form contacts from the conversation sent to the model
- Added question quotas, a model queue and fragment fallback when the provider is unavailable
- Prepared a preview-only enquiry mode, fictional contacts and session/file deletion on reset
Result
The complete journey from a document question to a contextual enquiry works. The widget connects with one script line; the Telegram bot shares its knowledge and answer rules. The site offers a live widget, document uploads and a browser preview of the Telegram flow without sending messages.
On a small acceptance set, retrieval ranks the right fragment first for 16 of 16 questions. Without a model, 12 receive an answer and four paraphrases need a model; seven off-topic questions receive “don't know”. This verifies a fixed test set and does not promise AI accuracy for arbitrary questions.
Developer's note
What was hard
The main challenge was distinguishing similar text from an actual answer. Price words appear in several sections, and a weather question can share words with the price list. I separated candidate retrieval from model verification, added sources and explicit decision reasons.
The service also needed to handle failures and concurrent questions. Quota slots are reserved atomically, the budget is checked before model calls, and network failures fall back to retrieval. Form contacts never enter subsequent model requests.
What came easy
A separate Python engine made sharing logic between channels straightforward. The widget and Telegram bot submit questions and receive the same answers, sources and form steps. Price updates do not require two independent implementations.
Plain Markdown files make the knowledge base easy to maintain. Delivery terms, prices and FAQs have readable sections that visitors can expand under an answer and compare with the source document.
Technologies
PythonFastAPIPostgreSQLGigaChataiogramDocker