Hybrid Ecosystem for Sales and Support Automation
Most ready-made chat widgets in the market either function as simple auto-responders with rigid rules or require complex manual scenario setups for each language version of the site. Meanwhile, operators often cannot 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 has developed AI-Robot Chat — a fail-safe corporate AI consulting platform. It is a fully ready software suite with an open architecture, deployed on your servers, ensuring complete independence from third-party subscription services and providing instant interface response.
Technical Architecture and 'Guts' of the AI-Robot Chat System
1. Dynamic Content Bridge (Dynamic Decoupled Knowledge Base)
The main architectural feature of AI-Robot Chat is the complete separation of bot knowledge from backend software code. The bot operates as an 'empty shell,' with all knowledge about your services, prices, and rules dynamically loaded from external JSON files (e.g., ru.json, es.json) from a remote server.
- Upon launch and on request, the
kb_service.pyservice downloads knowledge files, strips them of HTML tags, and transforms structured blocks into flat text context. - The system takes an instruction template (System Prompt), dynamically inserts the stripped knowledge into the context marker, and adds a strict language communication directive at the very end, preventing confusion in multilingual dialogues.
2. Fast and Adaptive Frontend (Svelte 5 Chat Widget)
The chat interface is developed on the Svelte 5 framework, ensuring minimal bundle size and instant widget operation without slowing down your main site.
- Auto Language Detection: The widget reads the
langattribute of thehtmltag. If the language on your site (React/Svelte SPA) changes without page reload, the built-inMutationObserverinstantly detects it, clears the chat window, and requests a greeting in the new language. - Hybrid Connection: REST API is used for fast loading of message history and settings, while asynchronous WebSockets provide instant two-way message exchange and real-time 'Typing...' status display.
- Rich Content: The chat supports rendering Markdown (lists, bold/italic font), displaying attached screenshots, and file uploads.
3. High-Performance Asynchronous Core (FastAPI)
The server part of AI-Robot Chat is built on FastAPI in Python. For working with databases (Firebase) and tables (Google Sheets), we use asynchronous thread distribution via asyncio.to_thread. While one thread waits for log entries or data submission to Google Sheets, the main FastAPI core continues to instantly serve hundreds of active WebSocket connections of other users without delays.
A special connection manager (ws_manager.py) tracks user status in real time. If a client opens a site tab, the operator sees a green presence indicator; if closed, the indicator instantly turns off, saving the manager's time.
4. Fail-Safe AI Engine: 'Waterfall' Architecture (Waterfall AI Engine)
The system's brain (module ai_service.py) is protected from AI provider failures. We implemented a cascading request model: if the priority model (e.g., OpenAI) returns an error or does not respond within 20 seconds, the bot automatically redirects the request to Gemini, and in case of repeated failure, to xAI or Mistral. The client receives an uninterrupted response even if one of the AI services is globally unavailable.
5. Intelligent Lead Generation (Function Calling)
The AI does not just mimic communication. Using Function Calling technology, the bot semantically recognizes when a user leaves their contact details (phone, email, messenger nickname). At this moment, the system instantly calls the technical function save_lead, intercepts the contacts, and sends an instant notification in Telegram to the business owner.
6. Professional Operator Panel (NiceGUI & AG Grid)
The interface for managers is developed based on NiceGUI and provides a full-fledged workplace:
- Instant Interception (Human Mode): The manager sees the client's dialogue with AI in real time and can intercept control from the robot in one click, switching the chat to manual mode. Activity indicators show if any colleague-managers are also viewing this chat, preventing confusion.
- Analytics Dashboard: Displays key business KPIs in real time (number of unique sessions, active dialogues, conversion to leads).
- Intelligent DB Management via AG Grid: The table allows filtering thousands of sessions by countries, UTM tags, visit dates, entry pages, and mass archiving or deletion. The table remembers column settings individually for each manager.
Main Advantages of AI-Robot Chat for Your Business
- Complete Knowledge Base Autonomy: The bot is trained on your JSON files, not requiring reprogramming when price lists or service conditions change.
- Maximum Response Speed: Asynchronous backend architecture and WebSockets eliminate any delays in message delivery.
- Absolute Transparency: You see the entire client path — from the UTM tag of the advertising campaign, IP address, and city to the page where the user opened the chat.
AI-Robot Chat is a corporate-class tool ready for high loads, automating up to 90% of customer service and turning your site visitors into purchase-ready leads. Contact AI-Robot Studio specialists to discuss the implementation of AI-Robot Chat on your site or platform customization for your business processes.