From b7c024c8c5b85f91828d6cd20ffc3bfca229af21 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Wed, 7 Aug 2024 13:08:41 -0400 Subject: trying to get rules to delete after using rool --- .../nodes/ChatBox/vectorstore/VectorstoreUpload.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/client/views/nodes/ChatBox/vectorstore') diff --git a/src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts b/src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts index 0737e2392..787705bb6 100644 --- a/src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts +++ b/src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts @@ -16,8 +16,8 @@ export class Vectorstore { private index!: Index; private cohere: CohereClient; private indexName: string = 'pdf-chatbot'; - private id: string; - private file_ids: string[] = []; + private _id: string; + private _doc_ids: string[] = []; documents: AI_Document[] = []; constructor(id: string, doc_ids: () => string[]) { @@ -32,8 +32,8 @@ export class Vectorstore { this.cohere = new CohereClient({ token: process.env.COHERE_API_KEY, }); - this.id = id; - this.file_ids = doc_ids(); + this._id = id; + this._doc_ids = doc_ids(); this.initializeIndex(); } @@ -65,7 +65,7 @@ export class Vectorstore { console.log('Already in progress.'); return; } - if (!this.file_ids.includes(StrCast(doc.ai_doc_id))) this.file_ids.push(StrCast(doc.ai_doc_id)); + if (!this._doc_ids.includes(StrCast(doc.ai_doc_id))) this._doc_ids.push(StrCast(doc.ai_doc_id)); } else { doc.ai_document_status = 'PROGRESS'; console.log(doc); @@ -82,12 +82,12 @@ export class Vectorstore { console.log(`Document added: ${document_json.file_name}`); doc.summary = document_json.summary; doc.ai_doc_id = document_json.doc_id; - this.file_ids.push(document_json.doc_id); + this._doc_ids.push(document_json.doc_id); doc.ai_purpose = document_json.purpose; if (doc.vectorstore_id === undefined || doc.vectorstore_id === null || doc.vectorstore_id === '' || doc.vectorstore_id === '[]') { - doc.vectorstore_id = JSON.stringify([this.id]); + doc.vectorstore_id = JSON.stringify([this._id]); } else { - doc.vectorstore_id = JSON.stringify(JSON.parse(StrCast(doc.vectorstore_id)).concat([this.id])); + doc.vectorstore_id = JSON.stringify(JSON.parse(StrCast(doc.vectorstore_id)).concat([this._id])); } if (doc.chunk_simpl === undefined || doc.chunk_simpl === null || doc.chunk_simpl === '' || doc.chunk_simpl === '[]') { doc.chunk_simpl = JSON.stringify({ text_chunks: [], image_chunks: [] }); @@ -161,7 +161,7 @@ export class Vectorstore { const queryResponse: QueryResponse = await this.index.query({ vector: queryEmbedding, filter: { - doc_id: { $in: this.file_ids }, + doc_id: { $in: this._doc_ids }, }, topK, includeValues: true, -- cgit v1.2.3-70-g09d2