forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: refactor service to a uniform interface (lobehub#2062)
* ♻️ refactor: refactor the session service interface * ♻️ refactor: add file service interface * ♻️ refactor: add message service interface * ♻️ refactor: add topic service interface * ✅ test: add test for agent action
- Loading branch information
1 parent
5261a70
commit e6a3d51
Showing
40 changed files
with
691 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
import { FileService } from './client'; | ||
// import { getClientConfig } from '@/config/client'; | ||
import { ClientService } from './client'; | ||
|
||
export const fileService = new FileService(); | ||
// import { ServerService } from './server'; | ||
// | ||
// const { ENABLED_SERVER_SERVICE } = getClientConfig(); | ||
// | ||
// export const fileService = ENABLED_SERVER_SERVICE ? new ServerService() : new ClientService(); | ||
export const fileService = new ClientService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable typescript-sort-keys/interface */ | ||
import { DB_File } from '@/database/client/schemas/files'; | ||
import { FilePreview } from '@/types/files'; | ||
|
||
export interface IFileService { | ||
uploadFile(file: DB_File): Promise<any>; | ||
uploadImageByUrl(url: string, file: Pick<DB_File, 'name' | 'metadata'>): Promise<any>; | ||
removeFile(id: string): Promise<any>; | ||
removeAllFiles(): Promise<any>; | ||
getFile(id: string): Promise<FilePreview>; | ||
} |
Oops, something went wrong.