diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx index bd656a7f..0ecf3238 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx @@ -1,6 +1,6 @@ -import React, { useState, useRef } from "react"; +import React, { useState, useRef, memo, useEffect } from "react"; import { isMobile } from "react-device-detect"; -import { Loader, Menu, Send, X } from "react-feather"; +import { Loader, Menu, X } from "react-feather"; export default function PromptInput({ workspace, @@ -35,6 +35,17 @@ export default function PromptInput({ }; const setTextCommand = (command = "") => { + const storageKey = `workspace_chat_mode_${workspace.slug}`; + if (command === "/query") { + window.localStorage.setItem(storageKey, "query"); + window.dispatchEvent(new Event("workspace_chat_mode_update")); + return; + } else if (command === "/conversation") { + window.localStorage.setItem(storageKey, "chat"); + window.dispatchEvent(new Event("workspace_chat_mode_update")); + return; + } + onChange({ target: { value: `${command} ${message}` } }); }; @@ -45,13 +56,19 @@ export default function PromptInput({ className="flex flex-col gap-y-1 bg-white dark:bg-black-900 md:bg-transparent rounded-t-lg md:w-3/4 w-full mx-auto" >
- {/* Toggle selector? */} - {/* */} +