How worikgh/llm-web works
Main Components
a. Client-Side (Browser):
• WASM Frontend Module (llm-web-fe)
• HTML/CSS Interface
• WebSocket Connection Handler
b. Server-Side:
• Backend Server (llm-web-be)
• Authentication System
• User Data Store
• Session Manager
c. LLM Integration Layer:
• LLM Interface Module (llm-rs)
• OpenAI API Connection
• Model Management
d. Shared Components:
• Common Data Types (llm-web-common)
• Communication Protocols
Component Relationships
[Browser] → [WASM Frontend] ↔ [Backend Server] ↔ [LLM Interface] → [OpenAI API]
Detailed Component Breakdown
Frontend (llm-web-fe):
• Components for:
• Chat Interface (chat_div.rs)
• Login System (login_div.rs)
• Cost Display (cost_div.rs)
• Error Handling (error_div.rs)
• Request Management (make_request.rs)
Backend (llm-web-be):
• Highlight:
• Authorization Handler (authorisation.rs)
• Data Store (data_store.rs)
• Session Management (session.rs)
• Server Core (server.rs)
LLM Interface (llm-rs):
• Include:
• OpenAI Interface (openai_interface.rs)
• Context Management (context.rs)
• Model Information (model_info.rs)
• Fine-tuning Components (fine_tune_*.rs)
Additional Elements
• A security boundary showing HTTPS requirement
• WebSocket connection paths
• User data flow
• Where the OpenAI API key is used
• System prompt handling
• Context management flow
Technical Details
• Rust/WASM compilation boundary
• Lighttpd proxy configuration
• Certificate handling
• User data storage
• Session management flow
• Model mode switching capability
Notes for Implementation
• The separation between frontend and backend
• The role of llm-web-common in sharing types
• The security layer with HTTPS and authentication
• The modular nature of the LLM interface
• The stateful nature of chat sessions
• The cost tracking system
This system design should reflect both the current implementation and allow for the planned features mentioned in the README, such as additional LLM support beyond OpenAI.