Update package.json version and add typing state to SidepanelForm

This commit is contained in:
n4ze3m 2024-03-05 10:22:06 +05:30
parent faea2b2fa2
commit 8778129fb6
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{
"name": "pageassist",
"displayName": "Page Assist - A Web UI for Local AI Models",
"version": "1.0.6",
"version": "1.0.7",
"description": "Use your locally running AI models to assist you in your web browsing.",
"author": "n4ze3m",
"scripts": {

View File

@ -18,6 +18,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
const textareaRef = React.useRef<HTMLTextAreaElement>(null)
const inputRef = React.useRef<HTMLInputElement>(null)
const { sendWhenEnter, setSendWhenEnter } = useWebUI()
const [typing, setTyping] = React.useState<boolean>(false)
const textAreaFocus = () => {
if (textareaRef.current) {
@ -72,14 +73,14 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
}
})
const handleKeyDown = (e: KeyboardEvent) => {
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Process" || e.key === "229") return
if (
e.key === "Enter" &&
!e.shiftKey &&
!isSending &&
sendWhenEnter &&
!e.isComposing
!typing
) {
e.preventDefault()
form.onSubmit(async (value) => {
@ -171,7 +172,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => {
/>
<div className="w-full border-x border-t flex flex-col dark:border-gray-600 rounded-t-xl p-2">
<textarea
onKeyDown={(e) => handleKeyDown(e as unknown as KeyboardEvent)}
onKeyDown={(e) => handleKeyDown(e)}
ref={textareaRef}
className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100"
required