Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

feat: Delete Answer and Relevant from RestrictedUpstreamMap of Switch #1739 (#2039)

balibabu11dd23d8aa40
diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts
index 5f430c99e0..6e27d3b1b2 100644
--- a/web/src/locales/zh-traditional.ts
+++ b/web/src/locales/zh-traditional.ts
@@ -563,7 +563,7 @@ export default {
yes: '是',
no: '否',
key: 'key',
- componentId: '組件id',
+ componentId: '組件ID',
add: '新增',
operation: '操作',
run: '運行',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 53261c2354..414e4c1cd7 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -582,7 +582,7 @@ export default {
yes: '是',
no: '否',
key: 'key',
- componentId: '组件id',
+ componentId: '组件ID',
add: '新增',
operation: '操作',
run: '运行',
diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsx
index 7b0e689d6c..b2fa7d6ae4 100644
--- a/web/src/pages/flow/constant.tsx
+++ b/web/src/pages/flow/constant.tsx
@@ -471,7 +471,7 @@ export const RestrictedUpstreamMap = {
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
[Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
[Operator.ExeSQL]: [Operator.Begin],
- [Operator.Switch]: [Operator.Begin, Operator.Answer, Operator.Relevant],
+ [Operator.Switch]: [Operator.Begin],
};
export const NodeMap = {
diff --git a/web/src/pages/flow/switch-form/index.tsx b/web/src/pages/flow/switch-form/index.tsx
index 01d1455fae..6f9d11a83b 100644
--- a/web/src/pages/flow/switch-form/index.tsx
+++ b/web/src/pages/flow/switch-form/index.tsx
@@ -1,5 +1,5 @@
import { CloseOutlined } from '@ant-design/icons';
-import { Button, Card, Form, Input, Select, Typography } from 'antd';
+import { Button, Card, Divider, Form, Input, Select, Typography } from 'antd';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import {
@@ -14,11 +14,11 @@ import { IOperatorForm, ISwitchForm } from '../interface';
import { getOtherFieldValues } from '../utils';
const subLabelCol = {
- span: 9,
+ span: 11,
};
const subWrapperCol = {
- span: 15,
+ span: 13,
};
const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
@@ -53,27 +53,21 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
return (
<Form
- labelCol={{ span: 4 }}
- wrapperCol={{ span: 20 }}
+ labelCol={{ span: 8 }}
+ wrapperCol={{ span: 16 }}
form={form}
name="dynamic_form_complex"
autoComplete="off"
initialValues={{ conditions: [{}] }}
onValuesChange={onValuesChange}
>
- <Form.Item label={t('flow.to')} name={[SwitchElseTo]}>
- <Select
- allowClear
- options={buildCategorizeToOptions(getSelectedConditionTos())}
- />
- </Form.Item>
<Form.List name="conditions">
{(fields, { add, remove }) => (
<div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>
{fields.map((field) => (
<Card
size="small"
- title={`Item ${field.name + 1}`}
+ title={`Case ${field.name + 1}`}
key={field.key}
extra={
<CloseOutlined
@@ -105,7 +99,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
])}
/>
</Form.Item>
- <Form.Item label=" " colon={false}>
+ <Form.Item label="Condition">
<Form.List name={[field.name, 'items']}>
{(subFields, subOpt) => (
<div
@@ -165,7 +159,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
onClick={() => subOpt.add()}
block
>
- + {t('flow.addSubItem')}
+ + Add Condition
</Button>
</div>
)}
@@ -175,11 +169,18 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
))}
<Button type="dashed" onClick={() => add()} block>
- + {t('flow.addItem')}
+ + Add Case
</Button>
</div>
)}
</Form.List>
+ <Divider />
+ <Form.Item label={'ELSE'} name={[SwitchElseTo]}>
+ <Select
+ allowClear
+ options={buildCategorizeToOptions(getSelectedConditionTos())}
+ />
+ </Form.Item>
<Form.Item noStyle shouldUpdate>
{() => (
diff --git a/web/src/pages/flow/utils.ts b/web/src/pages/flow/utils.ts
index 7943c85255..86b6054233 100644
--- a/web/src/pages/flow/utils.ts
+++ b/web/src/pages/flow/utils.ts
@@ -232,5 +232,5 @@ export const getOtherFieldValues = (
);
export const generateSwitchHandleText = (idx: number) => {
- return `Item ${idx + 1}`;
+ return `Case ${idx + 1}`;
};