From 210f8f5f1cd19e9416a12524cce119b273334fd3 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Sat, 7 Sep 2024 11:48:36 -0400 Subject: reorganized parsers, added comments to vectorstore, and added citation popup for text citations --- src/client/views/nodes/ChatBox/ChatBox.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/client/views/nodes/ChatBox/ChatBox.tsx') diff --git a/src/client/views/nodes/ChatBox/ChatBox.tsx b/src/client/views/nodes/ChatBox/ChatBox.tsx index ff699aab3..98a2e6002 100644 --- a/src/client/views/nodes/ChatBox/ChatBox.tsx +++ b/src/client/views/nodes/ChatBox/ChatBox.tsx @@ -44,6 +44,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { @observable private linked_docs_to_add: ObservableSet = observable.set(); @observable private linked_csv_files: { filename: string; id: string; text: string }[] = []; @observable private isUploadingDocs: boolean = false; + @observable private citationPopup: { text: string; visible: boolean } = { text: '', visible: false }; // Private properties for managing OpenAI API, vector store, agent, and UI elements private openai: OpenAI; @@ -450,6 +451,9 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { DocumentManager.Instance.showDocument(highlightDoc, { willZoomCentered: true }, () => {}); break; case CHUNK_TYPE.TEXT: + this.citationPopup = { text: citation.direct_text ?? 'No text available', visible: true }; + setTimeout(() => (this.citationPopup.visible = false), 3000); // Hide after 3 seconds + DocumentManager.Instance.showDocument(doc, { willZoomCentered: true }, () => { const firstView = Array.from(doc[DocViews])[0] as DocumentView; firstView.ComponentView?.search?.(citation.direct_text ?? ''); @@ -730,6 +734,14 @@ export class ChatBox extends ViewBoxAnnotatableComponent() { )} + {/* Popup for citation */} + {this.citationPopup.visible && ( +
+

+ Text from your document: {this.citationPopup.text} +

+
+ )} ); } -- cgit v1.2.3-70-g09d2