diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx index e6ebaf0debc99796004d06a1d2d2a278dd81d257..0371d64e50b59d123806a420a51594f404c4101e 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx @@ -23,8 +23,9 @@ const HistoricalMessage = ({ return ( <div key={uuid} - className={`flex justify-center items-end w-full ${role === "user" ? USER_BACKGROUND_COLOR : AI_BACKGROUND_COLOR - }`} + className={`flex justify-center items-end w-full ${ + role === "user" ? USER_BACKGROUND_COLOR : AI_BACKGROUND_COLOR + }`} > <div className={`py-8 px-4 w-full flex gap-x-5 md:max-w-[800px] flex-col`} @@ -99,9 +100,9 @@ export default memo( // and the chatID matches between renders. (feedback icons) (prevProps, nextProps) => { return ( - (prevProps.message === nextProps.message) && - (prevProps.isLastMessage === nextProps.isLastMessage) && - (prevProps.chatId === nextProps.chatId) + prevProps.message === nextProps.message && + prevProps.isLastMessage === nextProps.isLastMessage && + prevProps.chatId === nextProps.chatId ); } -); \ No newline at end of file +); diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx index 0b28ac58717881d1b14700c2353fdbbefd7c4dc3..98ad11f8f9864b6c9a7e4b6d516fb9fa99437863 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx @@ -13,7 +13,7 @@ import AvailableAgentsButton, { } from "./AgentMenu"; import TextSizeButton from "./TextSizeMenu"; -export const PROMPT_INPUT_EVENT = 'set_prompt_input'; +export const PROMPT_INPUT_EVENT = "set_prompt_input"; export default function PromptInput({ submit, onChange, @@ -21,7 +21,7 @@ export default function PromptInput({ buttonDisabled, sendCommand, }) { - const [promptInput, setPromptInput] = useState(''); + const [promptInput, setPromptInput] = useState(""); const { showAgents, setShowAgents } = useAvailableAgents(); const { showSlashCommand, setShowSlashCommand } = useSlashCommands(); const formRef = useRef(null); @@ -31,12 +31,14 @@ export default function PromptInput({ // To prevent too many re-renders we remotely listen for updates from the parent // via an event cycle. Otherwise, using message as a prop leads to a re-render every // change on the input. - function handlePromptUpdate(e) { setPromptInput(e?.detail ?? ''); } + function handlePromptUpdate(e) { + setPromptInput(e?.detail ?? ""); + } useEffect(() => { - if (!!window) window.addEventListener(PROMPT_INPUT_EVENT, handlePromptUpdate); - return () => ( - window?.removeEventListener(PROMPT_INPUT_EVENT, handlePromptUpdate) - ) + if (!!window) + window.addEventListener(PROMPT_INPUT_EVENT, handlePromptUpdate); + return () => + window?.removeEventListener(PROMPT_INPUT_EVENT, handlePromptUpdate); }, []); useEffect(() => { @@ -115,7 +117,7 @@ export default function PromptInput({ watchForSlash(e); watchForAt(e); adjustTextArea(e); - setPromptInput(e.target.value) + setPromptInput(e.target.value); }} onKeyDown={captureEnter} required={true} diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx index 07608a7fee759eab784376a8d61d644834e1f905..b3cc0d942ba1fcdea2b8bdb2fecfae75433f2709 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx @@ -28,9 +28,11 @@ export default function ChatContainer({ workspace, knownHistory = [] }) { // Emit an update to the sate of the prompt input without directly // passing a prop in so that it does not re-render constantly. - function setMessageEmit(messageContent = '') { + function setMessageEmit(messageContent = "") { setMessage(messageContent); - window.dispatchEvent(new CustomEvent(PROMPT_INPUT_EVENT, { detail: messageContent })) + window.dispatchEvent( + new CustomEvent(PROMPT_INPUT_EVENT, { detail: messageContent }) + ); } const handleSubmit = async (event) => {