How martinrojas/chatbot-playground works
Client-Side Layer
• Components Module (src/lib/components)
• State Management (nanostores)
• Token Management System
• Use rounded rectangles for components
Server-Side Layer
• API Routes module (/api/chat)
• SSE handling mechanism
External Services
• OpenAI's ChatGPT API
Component Relationships:
• ChatMessage
• IOPanel
• SystemPanel
• SystemPrompts
• TokenCalculator
• MockWindow
State Management
• Message Stores
• Token Store
API Layer
• Chat Endpoint
• SSE Handler
Implementation Guidelines:
Use standardized symbols
• Rectangles with rounded corners for UI components
• Solid for direct calls
Components in layers from top to bottom
• UI Layer (Components)
• State Management Layer (Stores)
• API Layer (Server Routes)
• External Services Layer (ChatGPT API)
Use clear spacing and alignment
• Related components
• Maintain consistent spacing
• Align components vertically when they're in the same layer
Additional Notes:
Environment indicators
• Development (localhost:3000)
• Production (chat.martinrojas.dev)
Build/deployment flow (optional)
• Build process
• Adapter requirements for deployment
Remember to:
• Use consistent styling
• Version information
• A title and description
• Document any assumptions or important notes