### What problem does this PR solve? feat: add RelevantForm #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.8.0
| messagePlaceholder: 'message', | messagePlaceholder: 'message', | ||||
| messageMsg: 'Please input message or delete this field.', | messageMsg: 'Please input message or delete this field.', | ||||
| addField: 'Add field', | addField: 'Add field', | ||||
| loop: 'Loop', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', | 
| messagePlaceholder: '訊息', | messagePlaceholder: '訊息', | ||||
| messageMsg: '請輸入訊息或刪除此欄位。', | messageMsg: '請輸入訊息或刪除此欄位。', | ||||
| addField: '新增字段', | addField: '新增字段', | ||||
| loop: '環', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: '“保留所有權利 @ react”', | profile: '“保留所有權利 @ react”', | 
| messagePlaceholder: '消息', | messagePlaceholder: '消息', | ||||
| messageMsg: '请输入消息或删除此字段。', | messageMsg: '请输入消息或删除此字段。', | ||||
| addField: '新增字段', | addField: '新增字段', | ||||
| loop: '环', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', | 
| import { | import { | ||||
| BranchesOutlined, | |||||
| DatabaseOutlined, | DatabaseOutlined, | ||||
| MergeCellsOutlined, | MergeCellsOutlined, | ||||
| MessageOutlined, | MessageOutlined, | ||||
| QuestionOutlined, | |||||
| RocketOutlined, | RocketOutlined, | ||||
| SendOutlined, | SendOutlined, | ||||
| SlidersOutlined, | SlidersOutlined, | ||||
| Answer = 'Answer', | Answer = 'Answer', | ||||
| Categorize = 'Categorize', | Categorize = 'Categorize', | ||||
| Message = 'Message', | Message = 'Message', | ||||
| Relevant = 'Relevant', | |||||
| RewriteQuestion = 'RewriteQuestion', | |||||
| } | } | ||||
| export const operatorIconMap = { | export const operatorIconMap = { | ||||
| [Operator.Begin]: SlidersOutlined, | [Operator.Begin]: SlidersOutlined, | ||||
| [Operator.Categorize]: DatabaseOutlined, | [Operator.Categorize]: DatabaseOutlined, | ||||
| [Operator.Message]: MessageOutlined, | [Operator.Message]: MessageOutlined, | ||||
| [Operator.Relevant]: BranchesOutlined, | |||||
| [Operator.RewriteQuestion]: QuestionOutlined, | |||||
| }; | }; | ||||
| export const operatorMap = { | export const operatorMap = { | ||||
| [Operator.Begin]: { description: 'Begin description' }, | [Operator.Begin]: { description: 'Begin description' }, | ||||
| [Operator.Categorize]: { description: 'Categorize description' }, | [Operator.Categorize]: { description: 'Categorize description' }, | ||||
| [Operator.Message]: { description: 'Message description' }, | [Operator.Message]: { description: 'Message description' }, | ||||
| [Operator.Relevant]: { description: 'BranchesOutlined description' }, | |||||
| [Operator.RewriteQuestion]: { description: 'RewriteQuestion description' }, | |||||
| }; | }; | ||||
| export const componentMenuList = [ | export const componentMenuList = [ | ||||
| name: Operator.Message, | name: Operator.Message, | ||||
| description: operatorMap[Operator.Message].description, | description: operatorMap[Operator.Message].description, | ||||
| }, | }, | ||||
| { | |||||
| name: Operator.Relevant, | |||||
| description: operatorMap[Operator.Relevant].description, | |||||
| }, | |||||
| { | |||||
| name: Operator.RewriteQuestion, | |||||
| description: operatorMap[Operator.RewriteQuestion].description, | |||||
| }, | |||||
| ]; | ]; | ||||
| export const initialRetrievalValues = { | export const initialRetrievalValues = { | ||||
| [Operator.Retrieval]: [], | [Operator.Retrieval]: [], | ||||
| [Operator.Generate]: [], | [Operator.Generate]: [], | ||||
| [Operator.Message]: [], | [Operator.Message]: [], | ||||
| [Operator.Relevant]: [], | |||||
| [Operator.RewriteQuestion]: [], | |||||
| }; | }; | ||||
| export const NodeMap = { | export const NodeMap = { | ||||
| [Operator.Generate]: 'ragNode', | [Operator.Generate]: 'ragNode', | ||||
| [Operator.Answer]: 'ragNode', | [Operator.Answer]: 'ragNode', | ||||
| [Operator.Message]: 'ragNode', | [Operator.Message]: 'ragNode', | ||||
| [Operator.Relevant]: 'ragNode', | |||||
| [Operator.RewriteQuestion]: 'ragNode', | |||||
| }; | }; | 
| import GenerateForm from '../generate-form'; | import GenerateForm from '../generate-form'; | ||||
| import { useHandleFormValuesChange } from '../hooks'; | import { useHandleFormValuesChange } from '../hooks'; | ||||
| import MessageForm from '../message-form'; | import MessageForm from '../message-form'; | ||||
| import RelevantForm from '../relevant-form'; | |||||
| import RetrievalForm from '../retrieval-form'; | import RetrievalForm from '../retrieval-form'; | ||||
| import RewriteQuestionForm from '../rewrite-question-form'; | |||||
| interface IProps { | interface IProps { | ||||
| node?: Node; | node?: Node; | ||||
| [Operator.Answer]: AnswerForm, | [Operator.Answer]: AnswerForm, | ||||
| [Operator.Categorize]: CategorizeForm, | [Operator.Categorize]: CategorizeForm, | ||||
| [Operator.Message]: MessageForm, | [Operator.Message]: MessageForm, | ||||
| [Operator.Relevant]: RelevantForm, | |||||
| [Operator.RewriteQuestion]: RewriteQuestionForm, | |||||
| }; | }; | ||||
| const FlowDrawer = ({ | const FlowDrawer = ({ | 
| import LLMSelect from '@/components/llm-select'; | |||||
| import { useTranslate } from '@/hooks/commonHooks'; | |||||
| import { Form } from 'antd'; | |||||
| import { useSetLlmSetting } from '../hooks'; | |||||
| import { IOperatorForm } from '../interface'; | |||||
| const RelevantForm = ({ onValuesChange, form }: IOperatorForm) => { | |||||
| const { t } = useTranslate('chat'); | |||||
| useSetLlmSetting(form); | |||||
| return ( | |||||
| <Form | |||||
| name="basic" | |||||
| labelCol={{ span: 8 }} | |||||
| wrapperCol={{ span: 16 }} | |||||
| style={{ maxWidth: 600 }} | |||||
| initialValues={{ remember: true }} | |||||
| onValuesChange={onValuesChange} | |||||
| autoComplete="off" | |||||
| form={form} | |||||
| > | |||||
| <Form.Item | |||||
| name={'llm_id'} | |||||
| label={t('model', { keyPrefix: 'chat' })} | |||||
| tooltip={t('modelTip', { keyPrefix: 'chat' })} | |||||
| > | |||||
| <LLMSelect></LLMSelect> | |||||
| </Form.Item> | |||||
| </Form> | |||||
| ); | |||||
| }; | |||||
| export default RelevantForm; | 
| import LLMSelect from '@/components/llm-select'; | |||||
| import { useTranslate } from '@/hooks/commonHooks'; | |||||
| import { Form, InputNumber } from 'antd'; | |||||
| import { useSetLlmSetting } from '../hooks'; | |||||
| import { IOperatorForm } from '../interface'; | |||||
| const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => { | |||||
| const { t } = useTranslate('chat'); | |||||
| useSetLlmSetting(form); | |||||
| 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' })} | |||||
| > | |||||
| <LLMSelect></LLMSelect> | |||||
| </Form.Item> | |||||
| <Form.Item label={t('loop', { keyPrefix: 'flow' })} name="loop"> | |||||
| <InputNumber /> | |||||
| </Form.Item> | |||||
| </Form> | |||||
| ); | |||||
| }; | |||||
| export default RewriteQuestionForm; |