Fix: Creating Knowledge Base Support Enter Key (#7258)

### What problem does this PR solve?


[https://github.com/infiniflow/ragflow/issues/7180](https://github.com/infiniflow/ragflow/issues/7180)
When creating a knowledge base, support the enter key
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu
2025-04-25 18:53:52 +08:00
committed by GitHub
parent 3052006ba8
commit 3da8776a3c
11 changed files with 157 additions and 59 deletions

View File

@ -41,6 +41,12 @@ const YiyanModal = ({
onOk?.(data);
};
const handleKeyDown = async (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
await handleOk();
}
};
return (
<Modal
title={t('addLlmTitle', { name: llmFactory })}
@ -74,21 +80,24 @@ const YiyanModal = ({
name="llm_name"
rules={[{ required: true, message: t('yiyanModelNameMessage') }]}
>
<Input placeholder={t('yiyanModelNameMessage')} />
<Input
placeholder={t('yiyanModelNameMessage')}
onKeyDown={handleKeyDown}
/>
</Form.Item>
<Form.Item<FieldType>
label={t('addyiyanAK')}
name="yiyan_ak"
rules={[{ required: true, message: t('yiyanAKMessage') }]}
>
<Input placeholder={t('yiyanAKMessage')} />
<Input placeholder={t('yiyanAKMessage')} onKeyDown={handleKeyDown} />
</Form.Item>
<Form.Item<FieldType>
label={t('addyiyanSK')}
name="yiyan_sk"
rules={[{ required: true, message: t('yiyanSKMessage') }]}
>
<Input placeholder={t('yiyanSKMessage')} />
<Input placeholder={t('yiyanSKMessage')} onKeyDown={handleKeyDown} />
</Form.Item>
<Form.Item<FieldType>
label={t('maxTokens')}