diff --git a/frontend/app/chat/components/ChatMessage.tsx b/frontend/app/chat/components/ChatMessage.tsx index e2af6099e..754980986 100644 --- a/frontend/app/chat/components/ChatMessage.tsx +++ b/frontend/app/chat/components/ChatMessage.tsx @@ -30,6 +30,7 @@ const ChatMessage = forwardRef( "py-3 px-3 rounded-lg border border-black/10 dark:border-white/25 flex flex-col max-w-4xl overflow-hidden scroll-pt-32", left ? "self-start mr-20" : "self-end ml-20" )} + style={speaker === "user" ? { whiteSpace: "pre-line" } : {}} // Add this line to preserve line breaks > {speaker} <> diff --git a/frontend/app/chat/page.tsx b/frontend/app/chat/page.tsx index 0cf53188e..223b79f3a 100644 --- a/frontend/app/chat/page.tsx +++ b/frontend/app/chat/page.tsx @@ -32,11 +32,16 @@ export default function ChatPage() { }} className="w-full flex items-center justify-center gap-2" > - setQuestion(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); // Prevents the newline from being entered in the textarea + if (!isPending) askQuestion(); // Call the submit function here + } + }} className="w-full p-2 border border-gray-300 dark:border-gray-500 outline-none rounded dark:bg-gray-800" placeholder="Begin conversation here..." />