From 321977e670cbdf10f6c49fc9071e3260a8bd4aae Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Thu, 24 Apr 2025 12:06:11 -0400 Subject: Linking docs now works with visible docs --- .../nodes/chatbot/chatboxcomponents/ChatBox.tsx | 28 +++------------------- 1 file changed, 3 insertions(+), 25 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 33419e559..e09b4313f 100644 --- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx +++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx @@ -107,11 +107,11 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { this.vectorstore_id = StrCast(this.dataDoc.vectorstore_id); } this.vectorstore = new Vectorstore(this.vectorstore_id, this.retrieveDocIds); - this.agent = new Agent(this.vectorstore, this.retrieveSummaries, this.retrieveFormattedHistory, this.retrieveCSVData, this.addLinkedUrlDoc, this.createImageInDash, this.createDocInDash, this.createCSVInDash); + this.agent = new Agent(this.vectorstore, this.retrieveSummaries, this.retrieveFormattedHistory, this.retrieveCSVData, this.addLinkedUrlDoc, this.createImageInDash, this.createCSVInDash, this); // Reinitialize the DocumentMetadataTool with a direct reference to this ChatBox instance // This ensures the tool can properly access documents in the same Freeform view - this.agent.reinitializeDocumentMetadataTool(this); + this.agent.reinitializeDocumentMetadataTool(); this.messagesRef = React.createRef(); @@ -446,7 +446,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { private createCollectionWithChildren = (data: parsedDoc[], insideCol: boolean): Opt[] => data.map(doc => this.whichDoc(doc, insideCol)); @action - whichDoc = (doc: parsedDoc, insideCol: boolean): Opt => { + public whichDoc = (doc: parsedDoc, insideCol: boolean): Opt => { const options = OmitKeys(doc, ['doct_type', 'data']).omit as DocumentOptions; const data = (doc as parsedDocData).data; const ndoc = (() => { @@ -515,28 +515,6 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { return ndoc; }; - /** - * Creates a document in the dashboard. - * - * @param {string} doc_type - The type of document to create. - * @param {string} data - The data used to generate the document. - * @param {DocumentOptions} options - Configuration options for the document. - * @returns {Promise} A promise that resolves once the document is created and displayed. - */ - @action - createDocInDash = (pdoc: parsedDoc) => { - const linkAndShowDoc = (doc: Opt) => { - if (doc) { - LinkManager.Instance.addLink(Docs.Create.LinkDocument(this.Document, doc)); - this._props.addDocument?.(doc); - DocumentManager.Instance.showDocument(doc, { willZoomCentered: true }, () => {}); - } - }; - const doc = this.whichDoc(pdoc, false); - if (doc) linkAndShowDoc(doc); - return doc; - }; - /** * Creates a deck of flashcards. * -- cgit v1.2.3-70-g09d2