How surbhi20-hub/python-chatbot works
This NiceGUI chatbot takes user messages, optional attachments, language, and recent chat history; the frontend sends them to a FastAPI endpoint, which prepares model input and requests a reply from OpenRouter. The UI also manages persistent chat sessions, exports, greeting, theme, and voice input. README capabilities are included, though some frontend implementations were not sampled; those are represented only where the tree supports them.
Main entry points: app.py Chat interface · main.py Chat endpoint · openrouter_client.py Model client · file_utils.py File text extraction
Components 13
NiceGUI frontend
- Chat interface
frontend-python/app.py - Chat sessions
frontend-python/app.py - Chat export
frontend-python/app.py - Attachment picker
frontend-python/app.py - Voice input
frontend-python/app.py
Chat backend
- Chat endpoint
backend/main.py - Request model
backend/main.py - File text extraction
backend/file_utils.py
AI integration
- Language prompt
backend/openrouter_client.py - Model client
backend/openrouter_client.py
Other components
- Chat user
- Web Speech API
- OpenRouter
Connections 15
- Chat user → Chat interface: sends messages
- Chat interface → Chat sessions: reads and writes
- Chat interface → Chat export: exports chats
- Chat interface → Attachment picker: selects files
- Chat interface → Voice input: starts voice input
- Voice input → Web Speech API: transcribes speech
- Chat interface → Chat endpoint: posts chat request
- Chat endpoint → Request model: validates request
- Chat endpoint → Language prompt: builds language prompt
- Chat endpoint → File text extraction: extracts file text
- Chat endpoint → Model client: requests reply
- Model client → OpenRouter: sends model request
- OpenRouter → Model client: returns completion
- Model client → Chat endpoint: returns reply
- Chat endpoint → Chat interface: returns chat reply