diff --git a/src/frontend/src/modals/formModal/chatMessage/index.tsx b/src/frontend/src/modals/formModal/chatMessage/index.tsx index 499a7bee1..092d33092 100644 --- a/src/frontend/src/modals/formModal/chatMessage/index.tsx +++ b/src/frontend/src/modals/formModal/chatMessage/index.tsx @@ -10,7 +10,7 @@ import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; import { CodeBlock } from "./codeBlock"; import Convert from "ansi-to-html"; -import { User2, MessageSquare } from "lucide-react"; +import { User2, MessageSquare, ChevronDown } from "lucide-react"; import { Accordion, AccordionContent, @@ -31,6 +31,7 @@ export default function ChatMessage({ const convert = new Convert({ newline: true }); const [hidden, setHidden] = useState(true); const [template, setTemplate] = useState(chat.template); + const [promptOpen, setPromptOpen] = useState(false); return (
) : ( -
-
- - - - - Initial Prompt - - - { - // Make all the variables that are inside curly braces bold - template.split("\n").map((line, index) => { - const regex = /{([^}]+)}/g; - let match; - let parts = []; - let lastIndex = 0; - while ((match = regex.exec(line)) !== null) { - // Push text up to the match - if (match.index !== lastIndex) { - parts.push(line.substring(lastIndex, match.index)); - } - // Push div with matched text - if (chat.message[match[1]]) { - parts.push( - - {chat.message[match[1]]} - - ); - } - - // Update last index - lastIndex = regex.lastIndex; - } - // Push text after the last match - if (lastIndex !== line.length) { - parts.push(line.substring(lastIndex)); - } - return

{parts}

; - }) +
+ + + {promptOpen + ? template.split("\n").map((line, index) => { + const regex = /{([^}]+)}/g; + let match; + let parts = []; + let lastIndex = 0; + while ((match = regex.exec(line)) !== null) { + // Push text up to the match + if (match.index !== lastIndex) { + parts.push(line.substring(lastIndex, match.index)); } - - - - - {chat.message[chat.chatKey]} - - -
+ // Push div with matched text + if (chat.message[match[1]]) { + parts.push( + + {chat.message[match[1]]} + + ); + } + + // Update last index + lastIndex = regex.lastIndex; + } + // Push text after the last match + if (lastIndex !== line.length) { + parts.push(line.substring(lastIndex)); + } + return

{parts}

; + }) + : chat.message[chat.chatKey]} +
)}