mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-05 06:20:10 +01:00
18 lines
501 B
JavaScript
18 lines
501 B
JavaScript
|
const { purgeVectorCache, purgeSourceDocument } = require(".");
|
||
|
const { Document } = require("../../models/documents");
|
||
|
const { Workspace } = require("../../models/workspace");
|
||
|
|
||
|
async function purgeDocument(filename, meta) {
|
||
|
const workspaces = await Workspace.where();
|
||
|
for (const workspace of workspaces) {
|
||
|
await Document.removeDocuments(workspace, [filename]);
|
||
|
}
|
||
|
await purgeVectorCache(filename);
|
||
|
await purgeSourceDocument(filename);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
purgeDocument,
|
||
|
};
|