فهرست منبع

If all vector store files associated with a page are deleted, the vector store relation is also deleted.

Shun Miyazawa 1 سال پیش
والد
کامیت
c242ec0e59
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      apps/app/src/server/service/openai/openai.ts

+ 6 - 0
apps/app/src/server/service/openai/openai.ts

@@ -104,6 +104,12 @@ class OpenaiService implements IOpenaiService {
       }
 
       const undeletedFileIds = vectorStoreFileRelation.fileIds.filter(fileId => !deletedFileIds.includes(fileId));
+
+      if (undeletedFileIds.length === 0) {
+        await vectorStoreFileRelation.remove();
+        return;
+      }
+
       vectorStoreFileRelation.fileIds = undeletedFileIds;
       await vectorStoreFileRelation.save();
     }