@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.
40 lines (30 loc) • 1.07 kB
text/typescript
import { UploadFileParams } from '@lobechat/electron-client-ipc';
import { CreateFileParams } from '@lobechat/electron-server-ipc';
import FileService from '@/services/fileSrv';
import { ControllerModule, ipcClientEvent, ipcServerEvent } from './index';
export default class UploadFileCtr extends ControllerModule {
private get fileService() {
return this.app.getService(FileService);
}
('createFile')
async uploadFile(params: UploadFileParams) {
return this.fileService.uploadFile(params);
}
// ======== server event
('getStaticFilePath')
async getFileUrlById(id: string) {
return this.fileService.getFilePath(id);
}
('getFileHTTPURL')
async getFileHTTPURL(path: string) {
return this.fileService.getFileHTTPURL(path);
}
('deleteFiles')
async deleteFiles(paths: string[]) {
return this.fileService.deleteFiles(paths);
}
('createFile')
async createFile(params: CreateFileParams) {
return this.fileService.uploadFile(params);
}
}