mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-30 07:35:11 +08:00
### What problem does this PR solve? Feat: Render RewriteQuestionForm with shadcn-ui #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
b67697b6f2
commit
65d7c19979
@ -41,7 +41,9 @@ export function MessageHistoryWindowSizeFormField() {
|
||||
name={'message_history_window_size'}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('flow.messageHistoryWindowSize')}</FormLabel>
|
||||
<FormLabel tooltip={t('flow.messageHistoryWindowSizeTip')}>
|
||||
{t('flow.messageHistoryWindowSize')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} type={'number'}></Input>
|
||||
</FormControl>
|
||||
|
@ -114,8 +114,14 @@ export function useFormConfigMap() {
|
||||
},
|
||||
[Operator.RewriteQuestion]: {
|
||||
component: RewriteQuestionForm,
|
||||
defaultValues: {},
|
||||
schema: z.object({}),
|
||||
defaultValues: {
|
||||
message_history_window_size: 6,
|
||||
},
|
||||
schema: z.object({
|
||||
llm_id: z.string(),
|
||||
message_history_window_size: z.number(),
|
||||
language: z.string(),
|
||||
}),
|
||||
},
|
||||
[Operator.Baidu]: {
|
||||
component: BaiduForm,
|
||||
|
@ -1,39 +1,66 @@
|
||||
import LLMSelect from '@/components/llm-select';
|
||||
import MessageHistoryWindowSizeItem from '@/components/message-history-window-size-item';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Select } from 'antd';
|
||||
import { NextLLMSelect } from '@/components/llm-select';
|
||||
import { MessageHistoryWindowSizeFormField } from '@/components/message-history-window-size-item';
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
import { RAGFlowSelect } from '@/components/ui/select';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { GoogleLanguageOptions } from '../../constant';
|
||||
import { IOperatorForm } from '../../interface';
|
||||
import { INextOperatorForm } from '../../interface';
|
||||
|
||||
const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => {
|
||||
const { t } = useTranslate('chat');
|
||||
const RewriteQuestionForm = ({ form }: INextOperatorForm) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Form
|
||||
name="basic"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
onValuesChange={onValuesChange}
|
||||
autoComplete="off"
|
||||
form={form}
|
||||
>
|
||||
<Form.Item
|
||||
name={'llm_id'}
|
||||
label={t('model', { keyPrefix: 'chat' })}
|
||||
tooltip={t('modelTip', { keyPrefix: 'chat' })}
|
||||
<Form {...form}>
|
||||
<form
|
||||
className="space-y-6"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<LLMSelect></LLMSelect>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t('language')}
|
||||
name={'language'}
|
||||
tooltip={t('languageTip')}
|
||||
>
|
||||
<Select options={GoogleLanguageOptions} allowClear={true}></Select>
|
||||
</Form.Item>
|
||||
<MessageHistoryWindowSizeItem
|
||||
initialValue={6}
|
||||
></MessageHistoryWindowSizeItem>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="llm_id"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('chat.modelTip')}>
|
||||
{t('chat.model')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<NextLLMSelect {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="language"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('chat.languageTip')}>
|
||||
{t('chat.language')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
options={GoogleLanguageOptions}
|
||||
allowClear={true}
|
||||
{...field}
|
||||
></RAGFlowSelect>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<MessageHistoryWindowSizeFormField></MessageHistoryWindowSizeFormField>
|
||||
</form>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user