mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-06 21:05:47 +00:00
### What problem does this PR solve? feat: add RelevantForm #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
cd3c739982
commit
f26d01dfa3
@ -556,6 +556,7 @@ The above is the content you need to summarize.`,
|
|||||||
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',
|
||||||
|
|||||||
@ -517,6 +517,7 @@ export default {
|
|||||||
messagePlaceholder: '訊息',
|
messagePlaceholder: '訊息',
|
||||||
messageMsg: '請輸入訊息或刪除此欄位。',
|
messageMsg: '請輸入訊息或刪除此欄位。',
|
||||||
addField: '新增字段',
|
addField: '新增字段',
|
||||||
|
loop: '環',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: '“保留所有權利 @ react”',
|
profile: '“保留所有權利 @ react”',
|
||||||
|
|||||||
@ -535,6 +535,7 @@ export default {
|
|||||||
messagePlaceholder: '消息',
|
messagePlaceholder: '消息',
|
||||||
messageMsg: '请输入消息或删除此字段。',
|
messageMsg: '请输入消息或删除此字段。',
|
||||||
addField: '新增字段',
|
addField: '新增字段',
|
||||||
|
loop: '环',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
|
BranchesOutlined,
|
||||||
DatabaseOutlined,
|
DatabaseOutlined,
|
||||||
MergeCellsOutlined,
|
MergeCellsOutlined,
|
||||||
MessageOutlined,
|
MessageOutlined,
|
||||||
|
QuestionOutlined,
|
||||||
RocketOutlined,
|
RocketOutlined,
|
||||||
SendOutlined,
|
SendOutlined,
|
||||||
SlidersOutlined,
|
SlidersOutlined,
|
||||||
@ -14,6 +16,8 @@ export enum Operator {
|
|||||||
Answer = 'Answer',
|
Answer = 'Answer',
|
||||||
Categorize = 'Categorize',
|
Categorize = 'Categorize',
|
||||||
Message = 'Message',
|
Message = 'Message',
|
||||||
|
Relevant = 'Relevant',
|
||||||
|
RewriteQuestion = 'RewriteQuestion',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const operatorIconMap = {
|
export const operatorIconMap = {
|
||||||
@ -23,6 +27,8 @@ 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 = {
|
||||||
@ -34,6 +40,8 @@ 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 = [
|
||||||
@ -57,6 +65,14 @@ 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 = {
|
||||||
@ -115,6 +131,8 @@ export const RestrictedUpstreamMap = {
|
|||||||
[Operator.Retrieval]: [],
|
[Operator.Retrieval]: [],
|
||||||
[Operator.Generate]: [],
|
[Operator.Generate]: [],
|
||||||
[Operator.Message]: [],
|
[Operator.Message]: [],
|
||||||
|
[Operator.Relevant]: [],
|
||||||
|
[Operator.RewriteQuestion]: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NodeMap = {
|
export const NodeMap = {
|
||||||
@ -124,4 +142,6 @@ 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',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,7 +9,9 @@ import { Operator } from '../constant';
|
|||||||
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;
|
||||||
@ -22,6 +24,8 @@ const FormMap = {
|
|||||||
[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 = ({
|
||||||
|
|||||||
33
web/src/pages/flow/relevant-form/index.tsx
Normal file
33
web/src/pages/flow/relevant-form/index.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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;
|
||||||
34
web/src/pages/flow/rewrite-question-form/index.tsx
Normal file
34
web/src/pages/flow/rewrite-question-form/index.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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;
|
||||||
Loading…
x
Reference in New Issue
Block a user