Hybrid Ecosystem for Sales and Support Automation
Most ready-made chat widgets on the market either function as simple autoresponders with rigid rules or require complex manual setup of scenarios for each language version of the site. Meanwhile, operators often don’t see what the client is typing in real time, and AI models may freeze or produce errors during peak loads.
The AI-Robot Studio team developed AI-Robot Chat — a fault-tolerant enterprise AI consulting platform. It is a fully ready-to-use software suite with an open architecture that deploys on your servers, guarantees complete independence from third-party subscription services, and ensures instant interface response.
Technical Architecture and the "Guts" of AI-Robot Chat
1. Dynamic Content Bridge (Dynamic Decoupled Knowledge Base)
The main architectural feature of AI-Robot Chat is the complete separation of the bot’s knowledge from the backend code. The bot operates as an "empty shell," while all knowledge about your services, pricing, and rules is dynamically loaded from external JSON files (e.g., ru.json, es.json) on a remote server.
- At startup and upon request, the
kb_service.pyservice downloads the knowledge files, strips them of HTML tags, and converts structured blocks into flat text context. - The system takes an instruction template (System Prompt), dynamically inserts the cleaned knowledge into the context marker, and adds a strict language directive at the very end to prevent confusion in multilingual dialogues.
2. Fast and Adaptive Frontend (Svelte 5 Chat Widget)
The chat interface is built on the Svelte 5 framework, ensuring minimal bundle size and instant widget performance without slowing down your main website.
- Automatic language detection: The widget reads the
langattribute of thehtmltag. If your site (React/Svelte SPA) changes language without reloading the page, the built-inMutationObserverinstantly detects this, clears the chat window, and requests a greeting in the new language. - Hybrid communication: REST API is used for quick loading of message history and settings, while asynchronous WebSockets enable instant two-way message exchange and real-time display of the "Typing..." status.
- Rich Content: The chat supports Markdown rendering (lists, bold/italic text), displays attached screenshots, and allows file uploads.
3. High-Performance Asynchronous Core (FastAPI)
The server side of AI-Robot Chat is built on FastAPI using Python. For database operations (Firebase) and spreadsheets (Google Sheets), we use asynchronous thread distribution via asyncio.to_thread. While one thread waits for log writes or data submission to Google Sheets, the main FastAPI core continues to instantly serve hundreds of active WebSocket connections from other users without delays.
A dedicated connection manager (ws_manager.py) tracks user status in real time. If a client opens the site tab, the operator sees a green presence indicator; if they close it, the indicator instantly turns off, saving the manager’s time.
4. Fault-Tolerant AI Engine: Waterfall Architecture
The system’s brain (the ai_service.py module) is protected from AI provider failures. We implemented a cascading request model: if the priority model (e.g., OpenAI) returns an error or fails to respond within 20 seconds, the bot automatically redirects the request to Gemini, and in case of another failure, to xAI or Mistral. The client receives uninterrupted responses even if one of the AI services is globally unavailable.
5. Intelligent Lead Generation (Function Calling)
The AI doesn’t just simulate conversation. Using Function Calling technology, the bot semantically detects when a user leaves their contact details (phone, email, messenger nickname). At that moment, the system instantly triggers the save_lead function, captures the contacts, and sends an instant notification to the business owner via Telegram.
6. Professional Operator Panel (NiceGUI & AG Grid)
The interface for managers is built on NiceGUI and provides a full-fledged workspace:
- Instant Takeover (Human Mode): The manager sees the client’s conversation with the AI in real time and can take over control from the bot with a single click, switching the chat to manual mode. Activity indicators show if any colleagues are also viewing the chat, preventing confusion.
- Analytics Dashboard: Displays key business KPIs in real time (number of unique sessions, active dialogues, lead conversion).
- Intelligent Database Management via AG Grid: The table allows filtering thousands of sessions by country, UTM tags, visit dates, entry pages, and bulk archiving or deletion. The table saves column settings individually for each manager.
Key Benefits of AI-Robot Chat for Your Business
- Fully Autonomous Knowledge Base: The bot trains on your JSON files, eliminating the need for reprogramming when pricing or service terms change.
- Maximum Response Speed: The asynchronous backend architecture and WebSockets eliminate any delays in message delivery.
- Absolute Transparency: You see the entire customer journey — from the UTM tag of the ad campaign, IP address, and city to the page where the user opened the chat.
AI-Robot Chat is a ready-for-high-load enterprise-class tool that automates up to 90% of customer service and turns your website visitors into sales-ready leads. Contact AI-Robot Studio specialists to discuss implementing AI-Robot Chat on your site or customizing the platform for your business processes.