Component hierarchy
API service layer
ArenaService
Located atjs/api/services/ArenaService.js. Handles all chat and arena operations.
ThreadService
Located atjs/api/services/ThreadService.js.
ModelService
Located atjs/api/services/ModelService.js.
UserService
Located atjs/api/services/UserService.js.
UI components
ChatView (components/chat/ChatView.js)
Renders chat messages with markdown support and auto-scrolling. Handles both single and dual-chat message layouts.
ChatInput (components/ChatInput.js)
Text input with auto-resize textarea. Key behaviors:
- Auto-grows up to
maxTextareaHeight(180px default) - Enter to send, Shift+Enter for newline
- Configurable via
window.DUALMIND_CONFIG.ui
ShareModal (components/ShareModal.js)
Dialog for sharing threads. Changes thread visibility to public or unlisted and generates a shareable URL.
Header (components/Header.js)
Top navigation bar with user avatar, theme toggle, and navigation links.
HttpClient (js/api/core/HttpClient.js)
Central fetch wrapper that handles:
- Auth headers: Automatically injects
Authorization: Bearer <jwt>from Supabase session - Retry logic: Configurable retry attempts with exponential backoff
- Timeout: Default 30s, configurable via
DUALMIND_CONFIG.api.timeout - Error handling: Throws structured errors with status code and response body
- Base URL: Resolves from
DUALMIND_CONFIG.apiBaseUrl