### What problem does this PR solve? feat: Add SwitchForm #1739 ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.10.0
| <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> | 
| host: 'Host', | host: 'Host', | ||||
| port: 'Port', | port: 'Port', | ||||
| password: 'Password', | password: 'Password', | ||||
| switch: 'Switch', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', | 
| host: '主機', | host: '主機', | ||||
| port: '端口', | port: '端口', | ||||
| password: '密碼', | password: '密碼', | ||||
| switch: '條件', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: '“保留所有權利 @ react”', | profile: '“保留所有權利 @ react”', | 
| host: '主机', | host: '主机', | ||||
| port: '端口', | port: '端口', | ||||
| password: '密码', | password: '密码', | ||||
| switch: '条件', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', | 
| import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg'; | import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg'; | ||||
| import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg'; | import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg'; | ||||
| import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.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 { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg'; | ||||
| import { variableEnabledFieldMap } from '@/constants/chat'; | import { variableEnabledFieldMap } from '@/constants/chat'; | ||||
| BaiduFanyi = 'BaiduFanyi', | BaiduFanyi = 'BaiduFanyi', | ||||
| QWeather = 'QWeather', | QWeather = 'QWeather', | ||||
| ExeSQL = 'ExeSQL', | ExeSQL = 'ExeSQL', | ||||
| Switch = 'Switch', | |||||
| } | } | ||||
| export const operatorIconMap = { | export const operatorIconMap = { | ||||
| [Operator.BaiduFanyi]: baiduFanyiIcon, | [Operator.BaiduFanyi]: baiduFanyiIcon, | ||||
| [Operator.QWeather]: QWeatherIcon, | [Operator.QWeather]: QWeatherIcon, | ||||
| [Operator.ExeSQL]: ExeSqlIcon, | [Operator.ExeSQL]: ExeSqlIcon, | ||||
| [Operator.Switch]: SwitchIcon, | |||||
| }; | }; | ||||
| export const operatorMap = { | export const operatorMap = { | ||||
| [Operator.BaiduFanyi]: { backgroundColor: '#e5f2d3' }, | [Operator.BaiduFanyi]: { backgroundColor: '#e5f2d3' }, | ||||
| [Operator.QWeather]: { backgroundColor: '#a4bbf3' }, | [Operator.QWeather]: { backgroundColor: '#a4bbf3' }, | ||||
| [Operator.ExeSQL]: { backgroundColor: '#b9efe8' }, | [Operator.ExeSQL]: { backgroundColor: '#b9efe8' }, | ||||
| [Operator.Switch]: { backgroundColor: '#dbaff6' }, | |||||
| }; | }; | ||||
| export const componentMenuList = [ | export const componentMenuList = [ | ||||
| { | { | ||||
| name: Operator.KeywordExtract, | name: Operator.KeywordExtract, | ||||
| }, | }, | ||||
| { | |||||
| name: Operator.Switch, | |||||
| }, | |||||
| { | { | ||||
| name: Operator.DuckDuckGo, | name: Operator.DuckDuckGo, | ||||
| }, | }, | ||||
| top_n: 30, | top_n: 30, | ||||
| }; | }; | ||||
| export const initialSwitchValues = {}; | |||||
| export const CategorizeAnchorPointPositions = [ | export const CategorizeAnchorPointPositions = [ | ||||
| { top: 1, right: 34 }, | { top: 1, right: 34 }, | ||||
| { top: 8, right: 18 }, | { top: 8, right: 18 }, | ||||
| [Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval], | [Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval], | ||||
| [Operator.QWeather]: [Operator.Begin, Operator.Retrieval], | [Operator.QWeather]: [Operator.Begin, Operator.Retrieval], | ||||
| [Operator.ExeSQL]: [Operator.Begin], | [Operator.ExeSQL]: [Operator.Begin], | ||||
| [Operator.Switch]: [Operator.Begin, Operator.Answer, Operator.Relevant], | |||||
| }; | }; | ||||
| export const NodeMap = { | export const NodeMap = { | ||||
| [Operator.BaiduFanyi]: 'ragNode', | [Operator.BaiduFanyi]: 'ragNode', | ||||
| [Operator.QWeather]: 'ragNode', | [Operator.QWeather]: 'ragNode', | ||||
| [Operator.ExeSQL]: 'ragNode', | [Operator.ExeSQL]: 'ragNode', | ||||
| [Operator.Switch]: 'logicNode', | |||||
| }; | }; | ||||
| export const LanguageOptions = [ | export const LanguageOptions = [ | 
| import RelevantForm from '../relevant-form'; | import RelevantForm from '../relevant-form'; | ||||
| import RetrievalForm from '../retrieval-form'; | import RetrievalForm from '../retrieval-form'; | ||||
| import RewriteQuestionForm from '../rewrite-question-form'; | import RewriteQuestionForm from '../rewrite-question-form'; | ||||
| import SwitchForm from '../switch-form'; | |||||
| import WikipediaForm from '../wikipedia-form'; | import WikipediaForm from '../wikipedia-form'; | ||||
| import styles from './index.less'; | import styles from './index.less'; | ||||
| interface IProps { | interface IProps { | ||||
| [Operator.BaiduFanyi]: BaiduFanyiForm, | [Operator.BaiduFanyi]: BaiduFanyiForm, | ||||
| [Operator.QWeather]: QWeatherForm, | [Operator.QWeather]: QWeatherForm, | ||||
| [Operator.ExeSQL]: ExeSQLForm, | [Operator.ExeSQL]: ExeSQLForm, | ||||
| [Operator.Switch]: SwitchForm, | |||||
| }; | }; | ||||
| const EmptyContent = () => <div>empty</div>; | const EmptyContent = () => <div>empty</div>; | 
| initialRelevantValues, | initialRelevantValues, | ||||
| initialRetrievalValues, | initialRetrievalValues, | ||||
| initialRewriteQuestionValues, | initialRewriteQuestionValues, | ||||
| initialSwitchValues, | |||||
| initialWikipediaValues, | initialWikipediaValues, | ||||
| } from './constant'; | } from './constant'; | ||||
| import { ICategorizeForm, IRelevantForm } from './interface'; | import { ICategorizeForm, IRelevantForm } from './interface'; | ||||
| [Operator.BaiduFanyi]: initialBaiduFanyiValues, | [Operator.BaiduFanyi]: initialBaiduFanyiValues, | ||||
| [Operator.QWeather]: initialQWeatherValues, | [Operator.QWeather]: initialQWeatherValues, | ||||
| [Operator.ExeSQL]: initialExeSqlValues, | [Operator.ExeSQL]: initialExeSqlValues, | ||||
| [Operator.Switch]: initialSwitchValues, | |||||
| }; | }; | ||||
| }, [llmId]); | }, [llmId]); | ||||
| const SwitchForm = () => { | |||||
| return <div>Switch</div>; | |||||
| }; | |||||
| export default SwitchForm; |