diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-11 13:42:00 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-11 13:42:00 -0400 |
| commit | a5d7f5c38192b91b7df3bd6ecace5ba7365449a6 (patch) | |
| tree | c6be94f983b5fcc65424b81d42ddb0718127404c /src/client/views/nodes/chatbot/chatboxcomponents | |
| parent | 3c28aa3a706869d818bc8a089e8d1a53f7234bc0 (diff) | |
Made it so chunk Ids are seperately managed and made sure the doc id is sonsistent and not created in python spawn
Diffstat (limited to 'src/client/views/nodes/chatbot/chatboxcomponents')
| -rw-r--r-- | src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | 36 |
1 files changed, 5 insertions, 31 deletions
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<FieldViewProps>() { 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<FieldViewProps>() { 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<FieldViewProps>() { @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<FieldViewProps>() { }; retrieveDocIds = (): string[] => { - return Array.from(this.docManager.listDocs()); + return Array.from(this.docManager.docIds); }; /** |
