Shun Miyazawa 1 год назад
Родитель
Сommit
7e0165fd1b
1 измененных файлов с 3 добавлено и 9 удалено
  1. 3 9
      apps/app/src/features/openai/server/services/openai.ts

+ 3 - 9
apps/app/src/features/openai/server/services/openai.ts

@@ -607,18 +607,12 @@ class OpenaiService implements IOpenaiService {
 
 
   async deleteAiAssistant(ownerId: string, aiAssistantId: string): Promise<AiAssistantDocument> {
   async deleteAiAssistant(ownerId: string, aiAssistantId: string): Promise<AiAssistantDocument> {
     const aiAssistant = await AiAssistantModel.findOne({ owner: ownerId, _id: aiAssistantId });
     const aiAssistant = await AiAssistantModel.findOne({ owner: ownerId, _id: aiAssistantId });
-
     if (aiAssistant == null) {
     if (aiAssistant == null) {
-      throw new Error('AiAssistant document is not exists');
+      throw new Error('AiAssistant document does not exist');
     }
     }
 
 
-    try {
-      const vectorStoreRelationId = getIdStringForRef(aiAssistant.vectorStore);
-      await this.deleteVectorStore(vectorStoreRelationId);
-    }
-    catch (err) {
-      throw new Error(err);
-    }
+    const vectorStoreRelationId = getIdStringForRef(aiAssistant.vectorStore);
+    await this.deleteVectorStore(vectorStoreRelationId);
 
 
     const deletedAiAssistant = await aiAssistant.remove();
     const deletedAiAssistant = await aiAssistant.remove();
     return deletedAiAssistant;
     return deletedAiAssistant;