How thinkinaixyz/deepchat works
Main components
• Main Process: This is the backend of the Electron app. It includes modules such as the eventbus, contextMenuHelper, several presenter folders (for file operations, devices, MCP, LLM providers, etc.), and support libraries (e.g., file adapters, configuration presenters).
• Renderer Process (Frontend/UI): This part is built using Vue components (as seen in many .vue component files), along with specific stores (state management), composables, routing, and internationalization (i18n). It presents the UI and handles user interactions.
• Preload Scripts: The preload folder provides typed integration between the main and renderer processes (exposing APIs in a secure manner).
• Build and Deployment Components: The build scripts, Dockerfile, and Electron Builder configuration files indicate platform-specific packaging and deployment procedures.
• External Integrations: There is explicit support for multiple model providers (e.g., DeepSeek, OpenAI, Ollama, Silicon Flow, etc.) and local model management. This module is handled mainly via the presenter modules (such as llmProviderPresenter, llamaCppPresenter, and devicePresenter).
• Internationalization: Multiple language directories under the renderer (i18n for en-US, zh-CN, etc.) indicate the project supports multiple locales.
Relationships and interactions
• The Main Process is responsible for managing system-level events, configurations, file operations, and acts as the orchestrator. It uses “presenter” modules to abstract the business logic (from file handling to model provider interactions).
• The Renderer process (built with Vue) communicates with the Main process via the Preload API. User interactions (e.g., chat input, selections, file uploads) trigger events that route to the appropriate presenter services via API calls.
• Between the Renderer and Main, an eventbus mechanism (and IPC in Electron) passes information like chat messages, model requests, and configuration changes.
• The build system (scripts, Dockerfile, and electron-builder configuration) packages the app for different platforms, with specific nuances for Windows, macOS, and Linux.
• Integration with multiple external LLM services is handled by a common API compatibility layer (structured via llmProviderPresenter with multiple “provider” implementations).
Architectural patterns and design principles
• Separation of Concerns: There is a clear split between business logic (presenters in the main process) and UI (renderer). The use of “presenter” modules suggests an MVP/MVC-inspired pattern.
• Modular Design: Each provider, file adapter, or presenter is organized into its own subfolder (for example, separate directories for filePresenter, mcpPresenter, etc.), making the system extensible.
• Multi-platform Support: Electron’s architecture (with distinct main and renderer processes) is leveraged, along with platform-specific build scripts.
• Internationalization: The localized i18n directories reflect a commitment to internationalize the UI.
• Use of modern frontend patterns: The user interface is built with Vue components, Vue Router for navigation, and state management via Pinia – all suggesting modern best practices.
Relevant technologies, frameworks, or libraries
• Electron – for building the desktop application.
• Vue (with .vue components) – for the renderer process UI.
• Pinia – for state management.
• Various model provider integrations via API layers (e.g., OpenAI, DeepSeek, Ollama).
• Electron Builder and related build configuration tools for packaging.