⬆️ refactor: Improve Text Commands (#3152)

* refactor(useMentions): separate usage of `useSelectMention`

* refactor: separate handleKeyUp logic from useTextarea

* fix(Mention): cleanup blur timer

* refactor(handleKeyUp): improve command handling, prevent unintended re-trigger

* chore: remove console log

* chore: temporarily comment plus command
This commit is contained in:
Danny Avila 2024-06-21 12:34:28 -04:00 committed by GitHub
parent b2b469bd3d
commit 24467dd626
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 121 additions and 38 deletions

View file

@ -7,7 +7,7 @@ import {
fileConfig as defaultFileConfig,
} from 'librechat-data-provider';
import { useChatContext, useAssistantsMapContext, useChatFormContext } from '~/Providers';
import { useRequiresKey, useTextarea, useSubmitMessage } from '~/hooks';
import { useRequiresKey, useTextarea, useSubmitMessage, useHandleKeyUp } from '~/hooks';
import { useAutoSave } from '~/hooks/Input/useAutoSave';
import { TextareaAutosize } from '~/components/ui';
import { useGetFileConfig } from '~/data-provider';
@ -34,12 +34,12 @@ const ChatForm = ({ index = 0 }) => {
);
const { requiresKey } = useRequiresKey();
const { handlePaste, handleKeyDown, handleKeyUp, handleCompositionStart, handleCompositionEnd } =
useTextarea({
textAreaRef,
submitButtonRef,
disabled: !!requiresKey,
});
const handleKeyUp = useHandleKeyUp({ index, textAreaRef });
const { handlePaste, handleKeyDown, handleCompositionStart, handleCompositionEnd } = useTextarea({
textAreaRef,
submitButtonRef,
disabled: !!requiresKey,
});
const {
files,