fix: input message duplicated due with some input sources (#1259)
This commit is contained in:
parent
75ad4462dc
commit
8757d4d086
@ -5,6 +5,7 @@ import { Button, Textarea } from '@janhq/uikit'
|
|||||||
|
|
||||||
import { useAtom, useAtomValue } from 'jotai'
|
import { useAtom, useAtomValue } from 'jotai'
|
||||||
|
|
||||||
|
import { debounce } from 'lodash'
|
||||||
import { StopCircle } from 'lucide-react'
|
import { StopCircle } from 'lucide-react'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
|
|
||||||
@ -82,7 +83,8 @@ const ChatScreen = () => {
|
|||||||
}
|
}
|
||||||
}, [currentPrompt])
|
}, [currentPrompt])
|
||||||
|
|
||||||
const onKeyDown = async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
const onKeyDown = debounce(
|
||||||
|
async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
if (!e.shiftKey) {
|
if (!e.shiftKey) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -91,7 +93,10 @@ const ChatScreen = () => {
|
|||||||
else onStopInferenceClick()
|
else onStopInferenceClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
50,
|
||||||
|
{ leading: false, trailing: true }
|
||||||
|
)
|
||||||
|
|
||||||
const onStopInferenceClick = async () => {
|
const onStopInferenceClick = async () => {
|
||||||
events.emit(EventName.OnInferenceStopped, {})
|
events.emit(EventName.OnInferenceStopped, {})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user