TensorBlock Studio is built using React and TypeScript with a component-based architecture. The application is divided into several key modules:
-
UI Components
- Located in
src/components/ - Responsible for rendering UI elements and handling user interactions
- Organized by functionality (chat, layout, pages, settings, ui)
- Located in
-
Services
- Located in
src/services/ - Provide core business logic and API integration
- Implement the singleton pattern for global state management
- Handle data transformation, API requests, and state updates
- Located in
-
Types
- Located in
src/types/ - Define interfaces and types used throughout the application
- Ensure type safety and code consistency
- Located in
-
Styles
- Located in
src/styles/ - Define styling for components and UI elements
- Located in
The application follows a unidirectional data flow:
- User interactions trigger component events
- Component events call service methods
- Services perform business logic and update state
- Updated state flows back to components for rendering
- Components render based on the latest state
The application uses a combination of:
- Service Singletons - For global application state
- React Hooks - For component-level state
- Context API - For passing state down the component tree
The application is built around several core services:
- ChatService - Manages conversations and message handling
- AIService - Interfaces with AI providers
- SettingsService - Manages user preferences and application settings
- DatabaseIntegrationService - Handles local data persistence
The application integrates with various AI providers through a provider abstraction layer:
- Provider interfaces are defined in
src/services/core/ai-service-provider.ts - Concrete provider implementations are located in
src/services/providers/ - The
ProviderFactorycreates provider instances based on configuration
The UI is organized into several main sections:
- Chat interface for conversations
- Settings panel for customization
- Conversation management sidebar
- Model selection controls
The application uses local storage for persistent data:
- Conversations and messages are stored locally
- User settings are persisted between sessions
- Database operations are encapsulated in the DatabaseIntegrationService