feat: Add SwitchForm #1739 (#1994)

### 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:
balibabu 2024-08-19 12:00:55 +08:00 committed by GitHub
parent 79426fc41f
commit 99b634c68d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 30 additions and 0 deletions

View File

@ -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>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -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',

View File

@ -764,6 +764,7 @@ export default {
host: '主機',
port: '端口',
password: '密碼',
switch: '條件',
},
footer: {
profile: '“保留所有權利 @ react”',

View File

@ -782,6 +782,7 @@ export default {
host: '主机',
port: '端口',
password: '密码',
switch: '条件',
},
footer: {
profile: 'All rights reserved @ React',

View File

@ -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 = [

View File

@ -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>;

View File

@ -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]);

View File

@ -0,0 +1,5 @@
const SwitchForm = () => {
return <div>Switch</div>;
};
export default SwitchForm;