RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: Add SwitchForm #1739 (#1994)
balibabu99b634c68d84
diff --git a/web/src/assets/svg/switch.svg b/web/src/assets/svg/switch.svgnew file mode 100644index 0000000000..df962f3ec7--- /dev/null+++ b/web/src/assets/svg/switch.svg@@ -0,0 +1,6 @@+<svg t="1724034437425" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1567"+ width="200" height="200">+ <path+ d="M128 522.666667c17.066667 0 32-14.933333 32-32v-170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h652.8l-83.2 83.2c-12.8 12.8-12.8 34.133333 0 46.933334 6.4 6.4 14.933333 10.666667 23.466666 10.666666s17.066667-4.266667 23.466667-10.666666l145.066667-145.066667c12.8-12.8 12.8-34.133333 0-46.933333l-145.066667-145.066667c-12.8-12.8-34.133333-12.8-46.933333 0-12.8 12.8-12.8 34.133333 0 46.933333l93.866666 93.866667H170.666667c-40.533333 0-74.666667 34.133333-74.666667 74.666667v170.666666c0 19.2 14.933333 34.133333 32 34.133334zM906.666667 501.333333c-17.066667 0-32 14.933333-32 32v170.666667c0 6.4-4.266667 10.666667-10.666667 10.666667H211.2l83.2-83.2c12.8-12.8 12.8-34.133333 0-46.933334-12.8-12.8-34.133333-12.8-46.933333 0l-145.066667 145.066667c-12.8 12.8-12.8 34.133333 0 46.933333l145.066667 145.066667c6.4 6.4 14.933333 10.666667 23.466666 10.666667s17.066667-4.266667 23.466667-10.666667c12.8-12.8 12.8-34.133333 0-46.933333l-93.866667-93.866667h663.466667c40.533333 0 74.666667-34.133333 74.666667-74.666667v-170.666666c0-19.2-12.8-34.133333-32-34.133334z"+ fill="#666666" p-id="1568"></path>+</svg>\ No newline at end of filediff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 0bd4aa914f..a7b5970f5b 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -806,6 +806,7 @@ The above is the content you need to summarize.`,host: 'Host',port: 'Port',password: 'Password',+ switch: 'Switch',},footer: {profile: 'All rights reserved @ React',diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.tsindex 8df77f654a..dc264817a3 100644--- a/web/src/locales/zh-traditional.ts+++ b/web/src/locales/zh-traditional.ts@@ -764,6 +764,7 @@ export default {host: '主機',port: '端口',password: '密碼',+ switch: '條件',},footer: {profile: '“保留所有權利 @ react”',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex 698ef1d8ae..245006e472 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -782,6 +782,7 @@ export default {host: '主机',port: '端口',password: '密码',+ switch: '条件',},footer: {profile: 'All rights reserved @ React',diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsxindex 29bd0dc4c7..91cb89098d 100644--- a/web/src/pages/flow/constant.tsx+++ b/web/src/pages/flow/constant.tsx@@ -11,6 +11,7 @@ import { ReactComponent as GoogleIcon } from '@/assets/svg/google.svg';import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg';import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.svg';+import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg';import { variableEnabledFieldMap } from '@/constants/chat';@@ -57,6 +58,7 @@ export enum Operator {BaiduFanyi = 'BaiduFanyi',QWeather = 'QWeather',ExeSQL = 'ExeSQL',+ Switch = 'Switch',}export const operatorIconMap = {@@ -82,6 +84,7 @@ export const operatorIconMap = {[Operator.BaiduFanyi]: baiduFanyiIcon,[Operator.QWeather]: QWeatherIcon,[Operator.ExeSQL]: ExeSqlIcon,+ [Operator.Switch]: SwitchIcon,};export const operatorMap = {@@ -178,6 +181,7 @@ export const operatorMap = {[Operator.BaiduFanyi]: { backgroundColor: '#e5f2d3' },[Operator.QWeather]: { backgroundColor: '#a4bbf3' },[Operator.ExeSQL]: { backgroundColor: '#b9efe8' },+ [Operator.Switch]: { backgroundColor: '#dbaff6' },};export const componentMenuList = [@@ -205,6 +209,9 @@ export const componentMenuList = [{name: Operator.KeywordExtract,},+ {+ name: Operator.Switch,+ },{name: Operator.DuckDuckGo,},@@ -381,6 +388,8 @@ export const initialExeSqlValues = {top_n: 30,};+export const initialSwitchValues = {};+export const CategorizeAnchorPointPositions = [{ top: 1, right: 34 },{ top: 8, right: 18 },@@ -450,6 +459,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],};export const NodeMap = {@@ -475,6 +485,7 @@ export const NodeMap = {[Operator.BaiduFanyi]: 'ragNode',[Operator.QWeather]: 'ragNode',[Operator.ExeSQL]: 'ragNode',+ [Operator.Switch]: 'logicNode',};export const LanguageOptions = [diff --git a/web/src/pages/flow/flow-drawer/index.tsx b/web/src/pages/flow/flow-drawer/index.tsxindex cf90877ff3..cf9da06d89 100644--- a/web/src/pages/flow/flow-drawer/index.tsx+++ b/web/src/pages/flow/flow-drawer/index.tsx@@ -27,7 +27,9 @@ import QWeatherForm from '../qweather-form';import RelevantForm from '../relevant-form';import RetrievalForm from '../retrieval-form';import RewriteQuestionForm from '../rewrite-question-form';+import SwitchForm from '../switch-form';import WikipediaForm from '../wikipedia-form';+import styles from './index.less';interface IProps {@@ -57,6 +59,7 @@ const FormMap = {[Operator.BaiduFanyi]: BaiduFanyiForm,[Operator.QWeather]: QWeatherForm,[Operator.ExeSQL]: ExeSQLForm,+ [Operator.Switch]: SwitchForm,};const EmptyContent = () => <div>empty</div>;diff --git a/web/src/pages/flow/hooks.ts b/web/src/pages/flow/hooks.tsindex 128273b56d..3e4f0a501c 100644--- a/web/src/pages/flow/hooks.ts+++ b/web/src/pages/flow/hooks.ts@@ -50,6 +50,7 @@ import {initialRelevantValues,initialRetrievalValues,initialRewriteQuestionValues,+ initialSwitchValues,initialWikipediaValues,} from './constant';import { ICategorizeForm, IRelevantForm } from './interface';@@ -109,6 +110,7 @@ export const useInitializeOperatorParams = () => {[Operator.BaiduFanyi]: initialBaiduFanyiValues,[Operator.QWeather]: initialQWeatherValues,[Operator.ExeSQL]: initialExeSqlValues,+ [Operator.Switch]: initialSwitchValues,};}, [llmId]);diff --git a/web/src/pages/flow/switch-form/index.tsx b/web/src/pages/flow/switch-form/index.tsxnew file mode 100644index 0000000000..1be6a7ad94--- /dev/null+++ b/web/src/pages/flow/switch-form/index.tsx@@ -0,0 +1,5 @@+const SwitchForm = () => {+ return <div>Switch</div>;+};++export default SwitchForm;