mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-16 16:40:40 +03:00
✨ multiple lines chat message input
This commit is contained in:
parent
a743821dc0
commit
65fd3637da
@ -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
|
||||
>
|
||||
<span className={cn("capitalize text-xs")}>{speaker}</span>
|
||||
<>
|
||||
|
@ -32,11 +32,16 @@ export default function ChatPage() {
|
||||
}}
|
||||
className="w-full flex items-center justify-center gap-2"
|
||||
>
|
||||
<input
|
||||
<textarea
|
||||
autoFocus
|
||||
type="text"
|
||||
value={question}
|
||||
onChange={(e) => 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..."
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user