mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 16:05:55 +08:00
### What problem does this PR solve? feat: translate fields of CategorizeForm #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
8c9b54db31
commit
44c7a0e281
@ -544,7 +544,15 @@ The above is the content you need to summarize.`,
|
|||||||
preview: 'Preview',
|
preview: 'Preview',
|
||||||
fileError: 'File error',
|
fileError: 'File error',
|
||||||
},
|
},
|
||||||
flow: { cite: 'Cite', citeTip: 'citeTip' },
|
flow: {
|
||||||
|
cite: 'Cite',
|
||||||
|
citeTip: 'citeTip',
|
||||||
|
name: 'Name',
|
||||||
|
nameMessage: 'Please input name',
|
||||||
|
description: 'Description',
|
||||||
|
examples: 'Examples',
|
||||||
|
to: 'To',
|
||||||
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
},
|
},
|
||||||
|
@ -505,7 +505,15 @@ export default {
|
|||||||
preview: '預覽',
|
preview: '預覽',
|
||||||
fileError: '文件錯誤',
|
fileError: '文件錯誤',
|
||||||
},
|
},
|
||||||
flow: { cite: '引用', citeTip: 'citeTip' },
|
flow: {
|
||||||
|
cite: '引用',
|
||||||
|
citeTip: 'citeTip',
|
||||||
|
name: '名稱',
|
||||||
|
nameMessage: '請輸入名稱',
|
||||||
|
description: '描述',
|
||||||
|
examples: '範例',
|
||||||
|
to: '到',
|
||||||
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: '“保留所有權利 @ react”',
|
profile: '“保留所有權利 @ react”',
|
||||||
},
|
},
|
||||||
|
@ -523,7 +523,15 @@ export default {
|
|||||||
preview: '预览',
|
preview: '预览',
|
||||||
fileError: '文件错误',
|
fileError: '文件错误',
|
||||||
},
|
},
|
||||||
flow: { cite: '引用', citeTip: 'citeTip' },
|
flow: {
|
||||||
|
cite: '引用',
|
||||||
|
citeTip: 'citeTip',
|
||||||
|
name: '名称',
|
||||||
|
nameMessage: '请输入名称',
|
||||||
|
description: '描述',
|
||||||
|
examples: '示例',
|
||||||
|
to: '到',
|
||||||
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
import { CloseOutlined } from '@ant-design/icons';
|
import { CloseOutlined } from '@ant-design/icons';
|
||||||
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
||||||
import { useUpdateNodeInternals } from 'reactflow';
|
import { useUpdateNodeInternals } from 'reactflow';
|
||||||
@ -13,6 +14,7 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
|||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const buildCategorizeToOptions = useBuildCategorizeToOptions();
|
const buildCategorizeToOptions = useBuildCategorizeToOptions();
|
||||||
const { handleSelectChange } = useHandleToSelectChange(nodeId);
|
const { handleSelectChange } = useHandleToSelectChange(nodeId);
|
||||||
|
const { t } = useTranslate('flow');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -40,25 +42,25 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="name"
|
label={t('name')}
|
||||||
name={[field.name, 'name']}
|
name={[field.name, 'name']}
|
||||||
// initialValue={`Categorize ${field.name + 1}`}
|
rules={[{ required: true, message: t('nameMessage') }]}
|
||||||
rules={[
|
|
||||||
{ required: true, message: 'Please input your name!' },
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="description"
|
label={t('description')}
|
||||||
name={[field.name, 'description']}
|
name={[field.name, 'description']}
|
||||||
>
|
>
|
||||||
<Input.TextArea rows={3} />
|
<Input.TextArea rows={3} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="examples" name={[field.name, 'examples']}>
|
<Form.Item
|
||||||
|
label={t('examples')}
|
||||||
|
name={[field.name, 'examples']}
|
||||||
|
>
|
||||||
<Input.TextArea rows={3} />
|
<Input.TextArea rows={3} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="to" name={[field.name, 'to']}>
|
<Form.Item label={t('to')} name={[field.name, 'to']}>
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
options={buildCategorizeToOptions(
|
options={buildCategorizeToOptions(
|
||||||
|
46
web/src/pages/flow/message-form/index.tsx
Normal file
46
web/src/pages/flow/message-form/index.tsx
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
|
import type { FormProps } from 'antd';
|
||||||
|
import { Form, Input } from 'antd';
|
||||||
|
import { IOperatorForm } from '../interface';
|
||||||
|
|
||||||
|
type FieldType = {
|
||||||
|
prologue?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
|
||||||
|
console.log('Success:', values);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
|
||||||
|
console.log('Failed:', errorInfo);
|
||||||
|
};
|
||||||
|
|
||||||
|
const MessageForm = ({ onValuesChange, form }: IOperatorForm) => {
|
||||||
|
const { t } = useTranslate('chat');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form
|
||||||
|
name="basic"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}
|
||||||
|
style={{ maxWidth: 600 }}
|
||||||
|
initialValues={{ remember: true }}
|
||||||
|
onFinish={onFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
onValuesChange={onValuesChange}
|
||||||
|
autoComplete="off"
|
||||||
|
form={form}
|
||||||
|
>
|
||||||
|
<Form.Item<FieldType>
|
||||||
|
name={'prologue'}
|
||||||
|
label={t('setAnOpener')}
|
||||||
|
tooltip={t('setAnOpenerTip')}
|
||||||
|
initialValue={t('setAnOpenerInitial')}
|
||||||
|
>
|
||||||
|
<Input.TextArea autoSize={{ minRows: 5 }} />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MessageForm;
|
Loading…
x
Reference in New Issue
Block a user