@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
34 lines (27 loc) • 1.07 kB
text/typescript
import { ElectronAppState, dispatch } from '@lobechat/electron-client-ipc';
/**
* Service class for interacting with Electron's system-level information and actions.
*/
class ElectronSystemService {
/**
* Fetches the application state from the Electron main process.
* This includes system information (platform, arch) and user-specific paths.
* @returns {Promise<DesktopAppState>} A promise that resolves with the desktop app state.
*/
async getAppState(): Promise<ElectronAppState> {
// Calls the underlying IPC function to get data from the main process
return dispatch('getDesktopAppState');
}
async closeWindow(): Promise<void> {
return dispatch('closeWindow');
}
async maximizeWindow(): Promise<void> {
return dispatch('maximizeWindow');
}
async minimizeWindow(): Promise<void> {
return dispatch('minimizeWindow');
}
// Add other system-related service methods here if needed in the future
}
// Export a singleton instance of the service
export const electronSystemService = new ElectronSystemService();