aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/vectorstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/ChatBox/vectorstore')
-rw-r--r--src/client/views/nodes/ChatBox/vectorstore/VectorstoreUpload.ts18
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,