diff --git a/client/src/components/Prompts/fields/PromptName.tsx b/client/src/components/Prompts/fields/PromptName.tsx index 57b37d4a5e..240249d5a1 100644 --- a/client/src/components/Prompts/fields/PromptName.tsx +++ b/client/src/components/Prompts/fields/PromptName.tsx @@ -53,7 +53,8 @@ const PromptName: React.FC = ({ name, isLoading = false, isError = false, setNewName(name); setIsEditing(false); } - if (e.key === 'Enter') { + // Ignore the Enter that commits an IME composition (see useTextarea.ts). + if (e.key === 'Enter' && !(e.nativeEvent.isComposing || e.keyCode === 229)) { e.preventDefault(); skipBlurRef.current = true; commitName(); diff --git a/client/src/components/Prompts/forms/PromptLabelsForm.tsx b/client/src/components/Prompts/forms/PromptLabelsForm.tsx index 1aa47c5eea..6c8088a212 100644 --- a/client/src/components/Prompts/forms/PromptLabelsForm.tsx +++ b/client/src/components/Prompts/forms/PromptLabelsForm.tsx @@ -16,7 +16,12 @@ const PromptLabelsForm = ({ selectedPrompt }: { selectedPrompt?: TPrompt }) => { }; const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && labelInput.trim()) { + // Ignore the Enter that commits an IME composition (see useTextarea.ts). + if ( + e.key === 'Enter' && + !(e.nativeEvent.isComposing || e.keyCode === 229) && + labelInput.trim() + ) { const newLabels = [...labels, labelInput.trim()]; setLabels(newLabels); setLabelInput(''); diff --git a/client/src/components/SidePanel/Parameters/DynamicTags.tsx b/client/src/components/SidePanel/Parameters/DynamicTags.tsx index bda6176414..6b8300e5d0 100644 --- a/client/src/components/SidePanel/Parameters/DynamicTags.tsx +++ b/client/src/components/SidePanel/Parameters/DynamicTags.tsx @@ -1,6 +1,6 @@ import { useState, useMemo, useCallback, useRef } from 'react'; -import type { DynamicSettingProps } from 'librechat-data-provider'; import { Label, Input, HoverCard, HoverCardTrigger, Tag, useToastContext } from '@librechat/client'; +import type { DynamicSettingProps } from 'librechat-data-provider'; import { TranslationKeys, useLocalize, useParameterEffects } from '~/hooks'; import { useChatContext } from '~/Providers'; import OptionHover from './OptionHover'; @@ -155,7 +155,8 @@ function DynamicTags({ if (e.key === 'Backspace' && !tagText) { onTagRemove(currentTags.length - 1); } - if (e.key === 'Enter') { + // Ignore the Enter that commits an IME composition (see useTextarea.ts). + if (e.key === 'Enter' && !(e.nativeEvent.isComposing || e.keyCode === 229)) { onTagAdd(); } }}