Understand the Nanobot WebUI architecture
mainThe Nanobot WebUI is structured as a Python package (webui) that integrates a FastAPI backend with a React frontend.
Backend Structure (webui/)
api/: Contains the FastAPI implementation, including routes for authentication, channels, configuration, cron jobs, MCP, OpenAI proxy, providers, sessions, skills, and users.channels/: Contains channel plugins (e.g.,weixin.pyfor WeChat).patches/: Contains minimal, non-invasive runtime monkey-patches applied at startup to improve quality-of-life (e.g.,mcp_dynamic.py,provider.py).utils/: Contains the unified configuration store located at~/.nanobot/webui_config.json.
Frontend Structure (web/)
- A React 18 + TypeScript application using Vite.
src/pages/: Contains route-specific components likeChat.tsx,Dashboard.tsx,MCPServers.tsx, andSettings.tsx.src/hooks/: Uses TanStack Query for data fetching.src/stores/: Uses Zustand for client-side state (auth, chat).
Design Principle
The backend is designed to be non-invasive. It imports nanobot libraries without patching their source code. Any necessary runtime patches in webui/patches/ are applied once at startup before nanobot internals are initialized.