diff --git a/src/Chat.svelte b/src/Chat.svelte
index 8ec8865..f668e46 100644
--- a/src/Chat.svelte
+++ b/src/Chat.svelte
@@ -6,6 +6,7 @@
import stream from "./stream";
export let groqKey: string;
+ let textarea: HTMLTextAreaElement;
const getModel = async () => {
if (localStorage.model) return localStorage.model;
@@ -46,6 +47,13 @@
}
};
+ const maybeFocus = (e: KeyboardEvent) => {
+ const isAlphanumeric = /^[a-zA-Z0-9]$/.test(e.key);
+ if (e.target == document.body && isAlphanumeric && !e.ctrlKey) {
+ textarea.focus();
+ }
+ };
+
let conversation: { role: string; content: string }[] = [];
const searchParams = new URLSearchParams(window.location.search);
const q = searchParams.get("q");
@@ -54,6 +62,7 @@
}
+
@@ -75,10 +84,9 @@
textarea.value = "";
}}
>
-