Feat: Use shadcn-ui to build GenerateForm. #3221 (#5449)

### What problem does this PR solve?

Feat: Use shadcn-ui to build GenerateForm. #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-02-27 18:13:41 +08:00
committed by GitHub
parent 651422127c
commit 244cf49ba4
11 changed files with 142 additions and 249 deletions

View File

@ -1,5 +1,14 @@
import { Form, InputNumber } from 'antd';
import { useFormContext } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from './ui/form';
import { Input } from './ui/input';
const MessageHistoryWindowSizeItem = ({
initialValue,
@ -21,3 +30,24 @@ const MessageHistoryWindowSizeItem = ({
};
export default MessageHistoryWindowSizeItem;
export function MessageHistoryWindowSizeFormField() {
const form = useFormContext();
const { t } = useTranslation();
return (
<FormField
control={form.control}
name={'message_history_window_size'}
render={({ field }) => (
<FormItem>
<FormLabel>{t('flow.messageHistoryWindowSize')}</FormLabel>
<FormControl>
<Input {...field} type={'number'}></Input>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
);
}