diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-07 13:08:41 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-07 13:08:41 -0400 |
| commit | b7c024c8c5b85f91828d6cd20ffc3bfca229af21 (patch) | |
| tree | 74536498c0301dbbc53b67f2eaac5fd40a7fa3d9 /src/client/views/nodes/ChatBox/vectorstore | |
| parent | a4107cdf6d53654275a678a79eff9962bcd02beb (diff) | |
trying to get rules to delete after using rool
Diffstat (limited to 'src/client/views/nodes/ChatBox/vectorstore')
| -rw-r--r-- | src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts | 18 |
1 files changed, 9 insertions, 9 deletions
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<RecordMetadata> = await this.index.query({ vector: queryEmbedding, filter: { - doc_id: { $in: this.file_ids }, + doc_id: { $in: this._doc_ids }, }, topK, includeValues: true, |
