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 services code style (lobehub#5180)
* ♻️ refactor: Refactor services code style * ✅ test: Fix test * 🐛 fix: Fix review problem
- Loading branch information
1 parent
df3ac87
commit e98ece8
Showing
36 changed files
with
524 additions
and
600 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
import { lambdaClient } from '@/libs/trpc/client'; | ||
|
||
class AgentService { | ||
async createAgentKnowledgeBase(agentId: string, knowledgeBaseId: string, enabled?: boolean) { | ||
return await lambdaClient.agent.createAgentKnowledgeBase.mutate({ | ||
createAgentKnowledgeBase = async ( | ||
agentId: string, | ||
knowledgeBaseId: string, | ||
enabled?: boolean, | ||
) => { | ||
return lambdaClient.agent.createAgentKnowledgeBase.mutate({ | ||
agentId, | ||
enabled, | ||
knowledgeBaseId, | ||
}); | ||
} | ||
}; | ||
|
||
async deleteAgentKnowledgeBase(agentId: string, knowledgeBaseId: string) { | ||
return await lambdaClient.agent.deleteAgentKnowledgeBase.mutate({ agentId, knowledgeBaseId }); | ||
} | ||
deleteAgentKnowledgeBase = async (agentId: string, knowledgeBaseId: string) => { | ||
return lambdaClient.agent.deleteAgentKnowledgeBase.mutate({ agentId, knowledgeBaseId }); | ||
}; | ||
|
||
async toggleKnowledgeBase(agentId: string, knowledgeBaseId: string, enabled?: boolean) { | ||
return await lambdaClient.agent.toggleKnowledgeBase.mutate({ | ||
toggleKnowledgeBase = async (agentId: string, knowledgeBaseId: string, enabled?: boolean) => { | ||
return lambdaClient.agent.toggleKnowledgeBase.mutate({ | ||
agentId, | ||
enabled, | ||
knowledgeBaseId, | ||
}); | ||
} | ||
}; | ||
|
||
async createAgentFiles(agentId: string, fileIds: string[], enabled?: boolean) { | ||
return await lambdaClient.agent.createAgentFiles.mutate({ agentId, enabled, fileIds }); | ||
} | ||
createAgentFiles = async (agentId: string, fileIds: string[], enabled?: boolean) => { | ||
return lambdaClient.agent.createAgentFiles.mutate({ agentId, enabled, fileIds }); | ||
}; | ||
|
||
async deleteAgentFile(agentId: string, fileId: string) { | ||
return await lambdaClient.agent.deleteAgentFile.mutate({ agentId, fileId }); | ||
} | ||
deleteAgentFile = async (agentId: string, fileId: string) => { | ||
return lambdaClient.agent.deleteAgentFile.mutate({ agentId, fileId }); | ||
}; | ||
|
||
async toggleFile(agentId: string, fileId: string, enabled?: boolean) { | ||
return await lambdaClient.agent.toggleFile.mutate({ | ||
toggleFile = async (agentId: string, fileId: string, enabled?: boolean) => { | ||
return lambdaClient.agent.toggleFile.mutate({ | ||
agentId, | ||
enabled, | ||
fileId, | ||
}); | ||
} | ||
}; | ||
|
||
async getFilesAndKnowledgeBases(agentId: string) { | ||
return await lambdaClient.agent.getKnowledgeBasesAndFiles.query({ agentId }); | ||
} | ||
getFilesAndKnowledgeBases = async (agentId: string) => { | ||
return lambdaClient.agent.getKnowledgeBasesAndFiles.query({ agentId }); | ||
}; | ||
} | ||
|
||
export const agentService = new AgentService(); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ImporterEntryData, OnImportCallbacks } from '@/types/importer'; | ||
import { UserSettings } from '@/types/user/settings'; | ||
|
||
export interface IImportService { | ||
importData(data: ImporterEntryData, callbacks?: OnImportCallbacks): Promise<void>; | ||
importSettings(settings: UserSettings): Promise<void>; | ||
} |
Oops, something went wrong.