MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / deleteDocumentFromDB

Function deleteDocumentFromDB

packages/baseai/src/utils/memory/db/lib.ts:140–158  ·  view source on GitHub ↗
({
	db,
	docName
}: {
	db: Low<Schema>;
	docName: string;
})

Source from the content-addressed store, hash-verified

138}
139
140export async function deleteDocumentFromDB({
141 db,
142 docName
143}: {
144 db: Low<Schema>;
145 docName: string;
146}): Promise<void> {
147 if (!db.data.documents[docName]) {
148 throw new Error(`Document with name "${docName}" does not exist`);
149 }
150
151 // Delete all chunks associated with the document
152 for (const chunkId of db.data.documents[docName].chunkIds) {
153 delete db.data.chunks[chunkId];
154 }
155
156 delete db.data.documents[docName];
157 await db.write();
158}
159
160export async function addChunksBulk(
161 {

Callers 2

generateEmbeddingsFunction · 0.90
deleteDocumentsFromDBFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected