UNPKG

@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.

35 lines (28 loc) 856 B
import { platform } from 'node:os'; import { App } from '@/core/App'; import { LinuxMenu } from './impls/linux'; import { MacOSMenu } from './impls/macOS'; import { WindowsMenu } from './impls/windows'; import { IMenuPlatform } from './types'; export type { IMenuPlatform, MenuOptions } from './types'; export const createMenuImpl = (app: App): IMenuPlatform => { const currentPlatform = platform(); switch (currentPlatform) { case 'darwin': { return new MacOSMenu(app); } case 'win32': { return new WindowsMenu(app); } case 'linux': { return new LinuxMenu(app); } default: { // 提供一个备用或抛出错误 console.warn( `Unsupported platform for menu: ${currentPlatform}, using Windows implementation as fallback.`, ); return new WindowsMenu(app); } } };