Преглед изворни кода

Early return if not VectorStoreFile of attachment

Shun Miyazawa пре 10 месеци
родитељ
комит
2952052ef8
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      apps/app/src/features/openai/server/services/openai.ts

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

@@ -437,6 +437,10 @@ class OpenaiService implements IOpenaiService {
   }
 
   private async deleteVectorStoreFileForAttachment(vectorStoreFileRelation: VectorStoreFileRelation): Promise<void> {
+    if (vectorStoreFileRelation.attachment == null) {
+      return;
+    }
+
     const deleteAllAttachmentVectorStoreFileRelations = async() => {
       await VectorStoreFileRelationModel.deleteMany({ attachment: vectorStoreFileRelation.attachment });
     };