From a5d7f5c38192b91b7df3bd6ecace5ba7365449a6 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Sun, 11 May 2025 13:42:00 -0400 Subject: Made it so chunk Ids are seperately managed and made sure the doc id is sonsistent and not created in python spawn --- .../nodes/chatbot/chatboxcomponents/ChatBox.tsx | 36 +++------------------- 1 file changed, 5 insertions(+), 31 deletions(-) (limited to 'src/client/views/nodes/chatbot/chatboxcomponents') diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx index d919b5f7f..34a1ade2e 100644 --- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx +++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx @@ -650,16 +650,8 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { citation: JSON.stringify(citation, null, 2), }); - // Try to find the document - let doc: Doc | undefined; - // First try to find the document using the document manager's chunk ID lookup - const parentDocId = this.docManager.getDocIdByChunkId(chunkId); - if (parentDocId) { - doc = this.docManager.getDocument(parentDocId); - console.log(`Found document by chunk ID lookup: ${parentDocId}`); - } - + const doc: Doc | undefined = this.docManager.getDocByChunkId(chunkId); if (!doc) { console.warn(`Document not found for citation with chunk_id: ${chunkId}`); return; @@ -989,32 +981,13 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { componentWillUnmount() { this.removeScrollListener(); } - - /** - * Getter that retrieves all linked documents for the current document. - */ - @computed get linkedDocs(): Doc[] { - const docIds = this.docManager.listDocs(); - const docs: Doc[] = []; - - // Get documents from the document manager using the getDocument method - docIds.forEach(id => { - const doc = this.docManager.getDocument(id); - if (doc) { - docs.push(doc); - } - }); - - return docs; - } - /** * Getter that retrieves document IDs of linked documents that have PDF_chunker–parsed content. */ @computed get docIds(): string[] { // Use the document manager to get all document IDs - return Array.from(this.docManager.listDocs()); + return Array.from(this.docManager.listDocs); } /** @@ -1023,7 +996,8 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { @computed get summaries(): string { // Use the document manager to get all summaries - return this.docManager.getAllDocumentSummaries(); + console.log(this.docManager.listDocs); + return JSON.stringify(this.docManager.listDocs); } /** @@ -1064,7 +1038,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { }; retrieveDocIds = (): string[] => { - return Array.from(this.docManager.listDocs()); + return Array.from(this.docManager.docIds); }; /** -- cgit v1.2.3-70-g09d2