How anish295/llm-chatbot-lyftr-ai works
Lyftr Chat is a React/FastAPI chatbot whose main workflow sends a session turn to the backend, rebuilds conversation context, obtains a cached or live LLM answer with key failover, and stores the successful exchange. The UI also restores history, exposes failure simulation and system-prompt settings, displays per-reply metadata, and supports export and themes. Backend request routing and service wiring are excerpted; several UI capabilities are documented or indexed but their full implementation was not sampled, so their internal links are limited to shown references.
Main entry points: App.tsx Chat interface · api.py Chat endpoints · config.py Runtime settings · llm_gateway.py LLM failover gateway
Components 18
Chat experience
- Chat interface
frontend/src/App.tsx - API client
frontend/src/api.ts - Reply display
frontend/src/components/AssistantMessage.tsx - Message composer
frontend/src/components/Composer.tsx - Failure simulator
frontend/src/components/FailureSimulator.tsx - Session restore
frontend/src/components/RestoreSession.tsx - Prompt settings
frontend/src/components/SystemPromptField.tsx - Theme control
frontend/src/theme.ts - Conversation export
frontend/src/export.ts
Request handling
- Chat endpoints
backend/app/api.py - Request middleware
backend/app/middleware.py - Runtime settings
backend/app/config.py - Session ordering
backend/app/session_locks.py
Inference and cache
- LLM failover gateway
backend/app/llm_gateway.py - Response cache
backend/app/cache.py
Session state
- SQLite sessions
backend/app/db.py
Other components
- Chat user
- LLM provider
Connections 20
- Chat user → Chat interface: uses
README.md - Chat interface → API client: requests
frontend/src/App.tsx - Chat interface → Reply display: renders
frontend/src/App.tsx - Chat interface → Message composer: renders
frontend/src/App.tsx - Chat interface → Failure simulator: renders
frontend/src/App.tsx - Chat interface → Session restore: renders
frontend/src/App.tsx - Chat interface → Prompt settings: renders
frontend/src/App.tsx - Chat interface → Theme control: uses
frontend/src/App.tsx - Chat interface → Conversation export: uses
frontend/src/App.tsx - API client → Chat endpoints: HTTP requests
README.md - Chat endpoints → SQLite sessions: reads and writes
backend/app/api.py - Chat endpoints → LLM failover gateway: completes turn
backend/app/api.py - Chat endpoints → Session ordering: serializes session
backend/app/api.py - Chat endpoints → Runtime settings: reads settings
backend/app/api.py - LLM failover gateway → LLM provider: inference calls
README.md - LLM failover gateway → Response cache: checks and stores
README.md - Request middleware → Chat endpoints: wraps requests
backend/app/main.py - Runtime settings → LLM failover gateway: configures
backend/app/main.py - Runtime settings → SQLite sessions: selects path
backend/app/main.py - Runtime settings → Response cache: configures
backend/app/main.py