mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
fix(Input): fix isNotAppendable condition to include isSubmitting variable
fix(Input): prevent submitting message when isSubmitting is true and Enter key is pressed
This commit is contained in:
parent
fd0152e39f
commit
78ae220f7e
1 changed files with 7 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
// const bingStylesRef = useRef(null);
|
// const bingStylesRef = useRef(null);
|
||||||
const [showBingToneSetting, setShowBingToneSetting] = useState(false);
|
const [showBingToneSetting, setShowBingToneSetting] = useState(false);
|
||||||
|
|
||||||
const isNotAppendable = latestMessage?.unfinished || latestMessage?.error;
|
const isNotAppendable = (latestMessage?.unfinished & !isSubmitting) || latestMessage?.error;
|
||||||
|
|
||||||
// auto focus to input, when enter a conversation.
|
// auto focus to input, when enter a conversation.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -69,12 +69,16 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyDown = e => {
|
const handleKeyDown = e => {
|
||||||
|
if (e.key === 'Enter' && isSubmitting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.shiftKey && !isComposing?.current) {
|
||||||
if (!isComposing?.current) submitMessage();
|
submitMessage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue