### What problem does this PR solve? feat: Add SwitchForm #1739 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -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 = [
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
5
web/src/pages/flow/switch-form/index.tsx
Normal file
5
web/src/pages/flow/switch-form/index.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
const SwitchForm = () => {
|
||||
return <div>Switch</div>;
|
||||
};
|
||||
|
||||
export default SwitchForm;
|
||||
Reference in New Issue
Block a user