diff options
author | sharkiecodes <lanyi_stroud@brown.edu> | 2025-07-22 13:44:08 -0400 |
---|---|---|
committer | sharkiecodes <lanyi_stroud@brown.edu> | 2025-07-22 13:44:08 -0400 |
commit | 8ff34d5335093c4ff85473227f39b3e83133d999 (patch) | |
tree | 39e295351356c81f88b6a028a70b9b812ab2a4f0 /src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | |
parent | d31a740378e8d4fd58ec329ba83dd20d28bfe5b4 (diff) |
Completed agent functionality - recognition of all documents on canvas
Diffstat (limited to 'src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx')
-rw-r--r-- | src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx index 732c4d637..195e85412 100644 --- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx +++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx @@ -49,6 +49,8 @@ import { AgentDocumentManager } from '../utils/AgentDocumentManager'; import { AiOutlineSend } from 'react-icons/ai'; import { SnappingManager } from '../../../../util/SnappingManager'; import { Button, Size, Type } from '@dash/components'; +import { MdLink, MdViewModule } from 'react-icons/md'; +import { Tooltip } from '@mui/material'; dotenv.config(); @@ -105,6 +107,12 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { this._inputValue = input; }); + @action + toggleCanvasMode = () => { + const newMode = !this.docManager.getCanvasMode(); + this.docManager.setCanvasMode(newMode); + }; + /** * Constructor initializes the component, sets up OpenAI, vector store, and agent instances, * and observes changes in the chat history to save the state in dataDoc. @@ -1438,8 +1446,25 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { )} <div className="chat-header"> <h2>{this.userName()}'s AI Assistant</h2> - <div className="font-size-control" onClick={this.toggleFontSizeModal}> - {this.renderFontSizeIcon()} + <div className="header-controls"> + <Tooltip title={ + <div className="dash-tooltip"> + {this.docManager.getCanvasMode() + ? "Click to limit scope to linked documents" + : "Click to expand scope to all documents on canvas" + } + </div> + } placement="bottom"> + <div + className={`canvas-mode-toggle ${this.docManager.getCanvasMode() ? 'canvas-active' : ''}`} + onClick={this.toggleCanvasMode} + > + {this.docManager.getCanvasMode() ? <MdViewModule /> : <MdLink />} + </div> + </Tooltip> + <div className="font-size-control" onClick={this.toggleFontSizeModal}> + {this.renderFontSizeIcon()} + </div> </div> {this._isFontSizeModalOpen && ( <div className="font-size-modal"> |