diff options
author | A.J. Shulman <Shulman.aj@gmail.com> | 2025-04-03 11:45:02 -0400 |
---|---|---|
committer | A.J. Shulman <Shulman.aj@gmail.com> | 2025-04-03 11:45:02 -0400 |
commit | a99d8df26d331d87bae4f27cd52ce5ec4d97fa7a (patch) | |
tree | ad1df355214acd734ecf4b25fa1157f5b252f4f0 /src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | |
parent | 45a9f5789fa6eaacca9a39cb96cc2a8e3ebe649c (diff) |
attempt
Diffstat (limited to 'src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx')
-rw-r--r-- | src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx index 6e9307d37..065c2780c 100644 --- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx +++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx @@ -43,6 +43,7 @@ import MessageComponentBox from './MessageComponent'; import { ProgressBar } from './ProgressBar'; import { OpenWhere } from '../../OpenWhere'; import { Upload } from '../../../../../server/SharedMediaTypes'; +import { DocumentMetadataTool } from '../tools/DocumentMetadataTool'; dotenv.config(); @@ -106,7 +107,21 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { 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.createDocInDash, + this.createCSVInDash + ); + + // 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.messagesRef = React.createRef<HTMLDivElement>(); // Reaction to update dataDoc when chat history changes @@ -408,7 +423,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { if (doc) { LinkManager.Instance.addLink(Docs.Create.LinkDocument(this.Document, doc)); this._props.addDocument?.(doc); - DocumentManager.Instance.showDocument(doc, { willZoomCentered: true }, () => {}).then(() => this.addCSVForAnalysis(doc, id)); + DocumentManager.Instance.showDocument(doc, { willZoomCentered: true }, () => this.addCSVForAnalysis(doc, id)); } }); |