|
@@ -86,7 +86,6 @@ export interface IOpenaiService {
|
|
|
createAiAssistant(data: Omit<AiAssistant, 'vectorStore'>): Promise<AiAssistantDocument>;
|
|
createAiAssistant(data: Omit<AiAssistant, 'vectorStore'>): Promise<AiAssistantDocument>;
|
|
|
updateAiAssistant(aiAssistantId: string, data: Omit<AiAssistant, 'vectorStore'>): Promise<AiAssistantDocument>;
|
|
updateAiAssistant(aiAssistantId: string, data: Omit<AiAssistant, 'vectorStore'>): Promise<AiAssistantDocument>;
|
|
|
getAccessibleAiAssistants(user: IUserHasId): Promise<AccessibleAiAssistants>
|
|
getAccessibleAiAssistants(user: IUserHasId): Promise<AccessibleAiAssistants>
|
|
|
- deleteAiAssistant(ownerId: string, aiAssistantId: string): Promise<AiAssistantDocument>
|
|
|
|
|
isLearnablePageLimitExceeded(user: IUserHasId, pagePathPatterns: string[]): Promise<boolean>;
|
|
isLearnablePageLimitExceeded(user: IUserHasId, pagePathPatterns: string[]): Promise<boolean>;
|
|
|
}
|
|
}
|
|
|
class OpenaiService implements IOpenaiService {
|
|
class OpenaiService implements IOpenaiService {
|
|
@@ -865,19 +864,6 @@ class OpenaiService implements IOpenaiService {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async deleteAiAssistant(ownerId: string, aiAssistantId: string): Promise<AiAssistantDocument> {
|
|
|
|
|
- const aiAssistant = await AiAssistantModel.findOne({ owner: ownerId, _id: aiAssistantId });
|
|
|
|
|
- if (aiAssistant == null) {
|
|
|
|
|
- throw createError(404, 'AiAssistant document does not exist');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const vectorStoreRelationId = getIdStringForRef(aiAssistant.vectorStore);
|
|
|
|
|
- await this.deleteVectorStore(vectorStoreRelationId);
|
|
|
|
|
-
|
|
|
|
|
- const deletedAiAssistant = await aiAssistant.remove();
|
|
|
|
|
- return deletedAiAssistant;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
async isLearnablePageLimitExceeded(user: IUserHasId, pagePathPatterns: string[]): Promise<boolean> {
|
|
async isLearnablePageLimitExceeded(user: IUserHasId, pagePathPatterns: string[]): Promise<boolean> {
|
|
|
const normalizedPagePathPatterns = removeGlobPath(pagePathPatterns);
|
|
const normalizedPagePathPatterns = removeGlobPath(pagePathPatterns);
|
|
|
|
|
|