Просмотр исходного кода

Revert "Execute setDefault after saving newData"

This reverts commit 4be003063b65c15e039e23740d83e1e4be14cc44.
Shun Miyazawa 1 год назад
Родитель
Сommit
556cc25e9a
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      apps/app/src/features/openai/server/services/openai.ts

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

@@ -829,6 +829,10 @@ class OpenaiService implements IOpenaiService {
       this.createVectorStoreFileWithStream(newVectorStoreRelation, conditions);
       this.createVectorStoreFileWithStream(newVectorStoreRelation, conditions);
     }
     }
 
 
+    if (data.shareScope !== AiAssistantShareScope.PUBLIC_ONLY && aiAssistant.isDefault) {
+      await AiAssistantModel.setDefault(aiAssistant._id, false);
+    }
+
     const newData = {
     const newData = {
       ...data,
       ...data,
       vectorStore: newVectorStoreRelation ?? aiAssistant.vectorStore,
       vectorStore: newVectorStoreRelation ?? aiAssistant.vectorStore,
@@ -837,10 +841,6 @@ class OpenaiService implements IOpenaiService {
     aiAssistant.set({ ...newData });
     aiAssistant.set({ ...newData });
     const updatedAiAssistant = await aiAssistant.save();
     const updatedAiAssistant = await aiAssistant.save();
 
 
-    if (data.shareScope !== AiAssistantShareScope.PUBLIC_ONLY && aiAssistant.isDefault) {
-      await AiAssistantModel.setDefault(aiAssistant._id, false);
-    }
-
     return updatedAiAssistant;
     return updatedAiAssistant;
   }
   }