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 (27 loc) 802 B
import FileService from '@/services/fileSrv'; import { ControllerModule, ipcClientEvent, ipcServerEvent } from './index'; interface UploadFileParams { content: ArrayBuffer; filename: string; hash: string; path: string; type: string; } export default class UploadFileCtr extends ControllerModule { private get fileService() { return this.app.getService(FileService); } @ipcClientEvent('createFile') async uploadFile(params: UploadFileParams) { return this.fileService.uploadFile(params); } // ======== server event @ipcServerEvent('getStaticFilePath') async getFileUrlById(id: string) { return this.fileService.getFilePath(id); } @ipcServerEvent('deleteFiles') async deleteFiles(paths: string[]) { return this.fileService.deleteFiles(paths); } }