Commit 1db6a5f9 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: textarea resizing

parent 085cb5ae
...@@ -675,6 +675,18 @@ ...@@ -675,6 +675,18 @@
} else if (messages.length != 0 && messages.at(-1).done != true) { } else if (messages.length != 0 && messages.at(-1).done != true) {
console.log('wait'); console.log('wait');
} else { } else {
document.getElementById('chat-textarea').style.height = '';
messages = [
...messages,
{
role: 'user',
content: userPrompt
}
];
prompt = '';
if (messages.length == 0) { if (messages.length == 0) {
await db.put('chats', { await db.put('chats', {
id: chatId, id: chatId,
...@@ -690,16 +702,6 @@ ...@@ -690,16 +702,6 @@
chats = await db.getAllFromIndex('chats', 'timestamp'); chats = await db.getAllFromIndex('chats', 'timestamp');
} }
messages = [
...messages,
{
role: 'user',
content: userPrompt
}
];
prompt = '';
setTimeout(() => { setTimeout(() => {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
}, 50); }, 50);
...@@ -1099,6 +1101,7 @@ ...@@ -1099,6 +1101,7 @@
}} }}
> >
<textarea <textarea
id="chat-textarea"
class="rounded-xl dark:bg-gray-700 dark:text-gray-100 outline-none border dark:border-gray-700 w-full py-3 px-5 pr-12 resize-none" class="rounded-xl dark:bg-gray-700 dark:text-gray-100 outline-none border dark:border-gray-700 w-full py-3 px-5 pr-12 resize-none"
placeholder="Send a message" placeholder="Send a message"
bind:value={prompt} bind:value={prompt}
...@@ -1107,7 +1110,6 @@ ...@@ -1107,7 +1110,6 @@
e.preventDefault(); e.preventDefault();
} }
if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) {
e.target.style.height = '';
submitPrompt(prompt); submitPrompt(prompt);
} }
}} }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment