diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index b1e2fcab9..70e242d2d 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -30,6 +30,8 @@ export default {
warn: 'Warn',
action: 'Action',
s: 'S',
+ pleaseSelect: 'Please select',
+ pleaseInput: 'Please input',
},
login: {
login: 'Sign in',
@@ -744,7 +746,7 @@ The above is the content you need to summarize.`,
googleDescription:
'This component is used to get search result fromhttps://www.google.com/ . Typically, it performs as a supplement to knowledgebases. Top N and SerpApi API key specifies the number of search results you need to adapt.',
bing: 'Bing',
- bingTip:
+ bingDescription:
'This component is used to get search result from https://www.bing.com/. Typically, it performs as a supplement to knowledgebases. Top N and Bing Subscription-Key specifies the number of search results you need to adapt.',
apiKey: 'API KEY',
country: 'Country',
@@ -1024,6 +1026,8 @@ The above is the content you need to summarize.`,
timeout: 'Timeout',
headers: 'Headers',
cleanHtml: 'Clean html',
+ reference: 'Reference',
+ input: 'Input',
},
footer: {
profile: 'All rights reserved @ React',
diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts
index 8afd6c5f5..c274fefd4 100644
--- a/web/src/locales/zh-traditional.ts
+++ b/web/src/locales/zh-traditional.ts
@@ -30,6 +30,8 @@ export default {
warn: '提醒',
action: '操作',
s: '秒',
+ pleaseSelect: '請選擇',
+ pleaseInput: '請輸入',
},
login: {
login: '登入',
@@ -697,7 +699,7 @@ export default {
googleDescription:
'此元件用於從https://www.google.com/取得搜尋結果。通常,它作為知識庫的補充。 Top N 和 SerpApi API 金鑰指定您需要調整的搜尋結果數量。',
bing: 'Bing',
- bingTip:
+ bingDescription:
'此元件用於從 https://www.bing.com/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 和 Bing Subscription-Key 指定您需要適配的搜尋結果數量。',
apiKey: 'API KEY',
country: '國家',
@@ -973,6 +975,8 @@ export default {
timeout: '超時',
headers: '請求頭',
cleanHtml: '清除 html',
+ reference: '引用',
+ input: '輸入',
},
footer: {
profile: '“保留所有權利 @ react”',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 10ac06912..d7d543dd6 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -30,6 +30,8 @@ export default {
warn: '提醒',
action: '操作',
s: '秒',
+ pleaseSelect: '请选择',
+ pleaseInput: '请输入',
},
login: {
login: '登录',
@@ -717,7 +719,7 @@ export default {
googleDescription:
'此组件用于从https://www.google.com/获取搜索结果。通常,它作为知识库的补充。Top N 和 SerpApi API 密钥指定您需要调整的搜索结果数量。',
bing: 'Bing',
- bingTip:
+ bingDescription:
'此组件用于从 https://www.bing.com/ 获取搜索结果。通常,它作为知识库的补充。Top N 和 Bing Subscription-Key 指定您需要调整的搜索结果数量。',
apiKey: 'API KEY',
country: '国家',
@@ -993,6 +995,8 @@ export default {
timeout: '超时',
headers: '请求头',
cleanHtml: '清除 html',
+ reference: '引用',
+ input: '输入',
},
footer: {
profile: 'All rights reserved @ React',
diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsx
index d6d711e5e..d55b24a59 100644
--- a/web/src/pages/flow/constant.tsx
+++ b/web/src/pages/flow/constant.tsx
@@ -343,10 +343,15 @@ export const componentMenuList = [
},
];
+const initialQueryBaseValues = {
+ query: [],
+};
+
export const initialRetrievalValues = {
similarity_threshold: 0.2,
keywords_similarity_weight: 0.3,
top_n: 8,
+ ...initialQueryBaseValues,
};
export const initialBeginValues = {
@@ -390,6 +395,7 @@ export const initialCategorizeValues = {
...initialLlmBaseValues,
message_history_window_size: 1,
category_description: {},
+ ...initialQueryBaseValues,
};
export const initialMessageValues = {
@@ -399,29 +405,35 @@ export const initialMessageValues = {
export const initialKeywordExtractValues = {
...initialLlmBaseValues,
top_n: 1,
+ ...initialQueryBaseValues,
};
export const initialDuckValues = {
top_n: 10,
channel: Channel.Text,
+ ...initialQueryBaseValues,
};
export const initialBaiduValues = {
top_n: 10,
+ ...initialQueryBaseValues,
};
export const initialWikipediaValues = {
top_n: 10,
language: 'en',
+ ...initialQueryBaseValues,
};
export const initialPubMedValues = {
top_n: 10,
email: '',
+ ...initialQueryBaseValues,
};
export const initialArXivValues = {
top_n: 10,
sort_by: 'relevance',
+ ...initialQueryBaseValues,
};
export const initialGoogleValues = {
@@ -429,6 +441,7 @@ export const initialGoogleValues = {
api_key: 'Xxx(get from https://serpapi.com/manage-api-key)',
country: 'cn',
language: 'en',
+ ...initialQueryBaseValues,
};
export const initialBingValues = {
@@ -438,12 +451,14 @@ export const initialBingValues = {
'"YOUR_ACCESS_KEY"(get from https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)',
country: 'CH',
language: 'en',
+ ...initialQueryBaseValues,
};
export const initialGoogleScholarValues = {
top_n: 5,
sort_by: 'relevance',
patents: true,
+ ...initialQueryBaseValues,
};
export const initialDeepLValues = {
@@ -453,12 +468,14 @@ export const initialDeepLValues = {
export const initialGithubValues = {
top_n: 5,
+ ...initialQueryBaseValues,
};
export const initialBaiduFanyiValues = {
appid: 'xxx',
secret_key: 'xxx',
trans_type: 'translate',
+ ...initialQueryBaseValues,
};
export const initialQWeatherValues = {
@@ -466,6 +483,7 @@ export const initialQWeatherValues = {
type: 'weather',
user_type: 'free',
time_period: 'now',
+ ...initialQueryBaseValues,
};
export const initialExeSqlValues = {
@@ -477,13 +495,18 @@ export const initialExeSqlValues = {
password: '',
loop: 3,
top_n: 30,
+ ...initialQueryBaseValues,
};
export const initialSwitchValues = { conditions: [] };
-export const initialWenCaiValues = { top_n: 20, query_type: 'stock' };
+export const initialWenCaiValues = {
+ top_n: 20,
+ query_type: 'stock',
+ ...initialQueryBaseValues,
+};
-export const initialAkShareValues = { top_n: 10 };
+export const initialAkShareValues = { top_n: 10, ...initialQueryBaseValues };
export const initialYahooFinanceValues = {
info: true,
@@ -492,6 +515,7 @@ export const initialYahooFinanceValues = {
balance_sheet: false,
cash_flow_statement: false,
news: true,
+ ...initialQueryBaseValues,
};
export const initialJin10Values = {
@@ -500,6 +524,7 @@ export const initialJin10Values = {
flash_type: '1',
contain: '',
filter: '',
+ ...initialQueryBaseValues,
};
export const initialConcentratorValues = {};
@@ -508,6 +533,7 @@ export const initialTuShareValues = {
token: 'xxx',
src: 'eastmoney',
start_date: '2024-01-01 09:00:00',
+ ...initialQueryBaseValues,
};
export const initialNoteValues = {
@@ -516,6 +542,7 @@ export const initialNoteValues = {
export const initialCrawlerValues = {
extract_type: 'markdown',
+ ...initialQueryBaseValues,
};
export const initialInvokeValues = {
diff --git a/web/src/pages/flow/form/akshare-form/index.tsx b/web/src/pages/flow/form/akshare-form/index.tsx
index 5161a897f..1e38fd930 100644
--- a/web/src/pages/flow/form/akshare-form/index.tsx
+++ b/web/src/pages/flow/form/akshare-form/index.tsx
@@ -1,17 +1,18 @@
import TopNItem from '@/components/top-n-item';
import { Form } from 'antd';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const AkShareForm = ({ onValuesChange, form }: IOperatorForm) => {
+const AkShareForm = ({ onValuesChange, form, node }: IOperatorForm) => {
return (
);
diff --git a/web/src/pages/flow/form/arxiv-form/index.tsx b/web/src/pages/flow/form/arxiv-form/index.tsx
index 23136f893..acae1b85e 100644
--- a/web/src/pages/flow/form/arxiv-form/index.tsx
+++ b/web/src/pages/flow/form/arxiv-form/index.tsx
@@ -3,8 +3,9 @@ import { useTranslate } from '@/hooks/common-hooks';
import { Form, Select } from 'antd';
import { useMemo } from 'react';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
+const ArXivForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useMemo(() => {
@@ -17,12 +18,13 @@ const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/baidu-fanyi-form/index.tsx b/web/src/pages/flow/form/baidu-fanyi-form/index.tsx
index bba9d9233..37cd376c0 100644
--- a/web/src/pages/flow/form/baidu-fanyi-form/index.tsx
+++ b/web/src/pages/flow/form/baidu-fanyi-form/index.tsx
@@ -6,8 +6,9 @@ import {
BaiduFanyiSourceLangOptions,
} from '../../constant';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
+const BaiduFanyiForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useMemo(() => {
return ['translate', 'fieldtranslate'].map((x) => ({
@@ -33,12 +34,12 @@ const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/baidu-form/index.tsx b/web/src/pages/flow/form/baidu-form/index.tsx
index b3a789ba1..bc810c061 100644
--- a/web/src/pages/flow/form/baidu-form/index.tsx
+++ b/web/src/pages/flow/form/baidu-form/index.tsx
@@ -1,17 +1,18 @@
import TopNItem from '@/components/top-n-item';
import { Form } from 'antd';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const BaiduForm = ({ onValuesChange, form }: IOperatorForm) => {
+const BaiduForm = ({ onValuesChange, form, node }: IOperatorForm) => {
return (
);
diff --git a/web/src/pages/flow/form/bing-form/index.tsx b/web/src/pages/flow/form/bing-form/index.tsx
index 879e68f7b..026453138 100644
--- a/web/src/pages/flow/form/bing-form/index.tsx
+++ b/web/src/pages/flow/form/bing-form/index.tsx
@@ -4,8 +4,9 @@ import { Form, Input, Select } from 'antd';
import { useMemo } from 'react';
import { BingCountryOptions, BingLanguageOptions } from '../../constant';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
+const BingForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useMemo(() => {
@@ -15,12 +16,12 @@ const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx b/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx
index dd8fd2c8a..f4319c4a0 100644
--- a/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx
+++ b/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx
@@ -1,5 +1,5 @@
import { useTranslate } from '@/hooks/common-hooks';
-import { CloseOutlined } from '@ant-design/icons';
+import { CloseOutlined, PlusOutlined } from '@ant-design/icons';
import {
Button,
Card,
@@ -197,8 +197,9 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
onClick={handleAdd}
block
className={styles.addButton}
+ icon={}
>
- + {t('addItem')}
+ {t('addItem')}
);
diff --git a/web/src/pages/flow/form/categorize-form/index.tsx b/web/src/pages/flow/form/categorize-form/index.tsx
index 075dffd4a..b9095057a 100644
--- a/web/src/pages/flow/form/categorize-form/index.tsx
+++ b/web/src/pages/flow/form/categorize-form/index.tsx
@@ -4,6 +4,7 @@ import { useTranslate } from '@/hooks/common-hooks';
import { Form } from 'antd';
import { useSetLlmSetting } from '../../hooks';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
import DynamicCategorize from './dynamic-categorize';
import { useHandleFormValuesChange } from './hooks';
@@ -25,6 +26,7 @@ const CategorizeForm = ({ form, onValuesChange, node }: IOperatorForm) => {
initialValues={{ items: [{}] }}
layout={'vertical'}
>
+
+ type === VariableType.Reference ? 'component_id' : 'value';
+
+const DynamicVariableForm = ({ nodeId }: IProps) => {
+ const { t } = useTranslation();
+ const valueOptions = useBuildComponentIdSelectOptions(nodeId);
+ const form = Form.useFormInstance();
+
+ const options = [
+ { value: VariableType.Reference, label: t('flow.reference') },
+ { value: VariableType.Input, label: t('flow.input') },
+ ];
+
+ const handleTypeChange = useCallback(
+ (name: number) => () => {
+ setTimeout(() => {
+ form.setFieldValue(['query', name, 'component_id'], undefined);
+ form.setFieldValue(['query', name, 'value'], undefined);
+ }, 0);
+ },
+ [form],
+ );
+
+ return (
+
+ {(fields, { add, remove }) => (
+ <>
+ {fields.map(({ key, name, ...restField }) => (
+
+
+
+
+
+ {({ getFieldValue }) => {
+ const type = getFieldValue(['query', name, 'type']);
+ return (
+
+ {type === VariableType.Reference ? (
+
+ ) : (
+
+ )}
+
+ );
+ }}
+
+ remove(name)} />
+
+ ))}
+
+
+
+ >
+ )}
+
+ );
+};
+
+const DynamicInputVariable = ({ nodeId }: IProps) => {
+ const { t } = useTranslation();
+
+ return (
+ {t('flow.input')},
+ children: ,
+ },
+ ]}
+ />
+ );
+};
+
+export default DynamicInputVariable;
diff --git a/web/src/pages/flow/form/components/index.less b/web/src/pages/flow/form/components/index.less
new file mode 100644
index 000000000..0cbcb0274
--- /dev/null
+++ b/web/src/pages/flow/form/components/index.less
@@ -0,0 +1,22 @@
+.dynamicInputVariable {
+ background-color: #ebe9e9;
+ :global(.ant-collapse-content) {
+ background-color: #f6f6f6;
+ }
+ margin-bottom: 20px;
+ .title {
+ font-weight: 600;
+ font-size: 16px;
+ }
+ .variableType {
+ width: 30%;
+ }
+ .variableValue {
+ flex: 1;
+ }
+
+ .addButton {
+ color: rgb(22, 119, 255);
+ font-weight: 600;
+ }
+}
diff --git a/web/src/pages/flow/form/crawler-form/index.tsx b/web/src/pages/flow/form/crawler-form/index.tsx
index 57c761f75..52e84567b 100644
--- a/web/src/pages/flow/form/crawler-form/index.tsx
+++ b/web/src/pages/flow/form/crawler-form/index.tsx
@@ -3,7 +3,8 @@ import { Form, Input, Select } from 'antd';
import { useMemo } from 'react';
import { CrawlerResultOptions } from '../../constant';
import { IOperatorForm } from '../../interface';
-const CrawlerForm = ({ onValuesChange, form }: IOperatorForm) => {
+import DynamicInputVariable from '../components/dynamic-input-variable';
+const CrawlerForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const crawlerResultOptions = useMemo(() => {
return CrawlerResultOptions.map((x) => ({
@@ -14,12 +15,12 @@ const CrawlerForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/deepl-form/index.tsx b/web/src/pages/flow/form/deepl-form/index.tsx
index b11cf4a7c..f532430a6 100644
--- a/web/src/pages/flow/form/deepl-form/index.tsx
+++ b/web/src/pages/flow/form/deepl-form/index.tsx
@@ -4,20 +4,21 @@ import { Form, Select } from 'antd';
import { DeepLSourceLangOptions, DeepLTargetLangOptions } from '../../constant';
import { useBuildSortOptions } from '../../form-hooks';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const DeepLForm = ({ onValuesChange, form }: IOperatorForm) => {
+const DeepLForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useBuildSortOptions();
return (
diff --git a/web/src/pages/flow/form/duckduckgo-form/index.tsx b/web/src/pages/flow/form/duckduckgo-form/index.tsx
index bf79951cc..68b611415 100644
--- a/web/src/pages/flow/form/duckduckgo-form/index.tsx
+++ b/web/src/pages/flow/form/duckduckgo-form/index.tsx
@@ -4,8 +4,9 @@ import { Form, Select } from 'antd';
import { useMemo } from 'react';
import { Channel } from '../../constant';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
+const DuckDuckGoForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useMemo(() => {
@@ -15,12 +16,12 @@ const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
{
+const ExeSQLForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const { testDbConnect, loading } = useTestDbConnect();
@@ -18,12 +19,12 @@ const ExeSQLForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
{
+const GithubForm = ({ onValuesChange, form, node }: IOperatorForm) => {
return (
);
diff --git a/web/src/pages/flow/form/google-form/index.tsx b/web/src/pages/flow/form/google-form/index.tsx
index 27ed2ec5e..310cde287 100644
--- a/web/src/pages/flow/form/google-form/index.tsx
+++ b/web/src/pages/flow/form/google-form/index.tsx
@@ -3,19 +3,20 @@ import { useTranslate } from '@/hooks/common-hooks';
import { Form, Input, Select } from 'antd';
import { GoogleCountryOptions, GoogleLanguageOptions } from '../../constant';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const GoogleForm = ({ onValuesChange, form }: IOperatorForm) => {
+const GoogleForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
return (
diff --git a/web/src/pages/flow/form/google-scholar-form/index.tsx b/web/src/pages/flow/form/google-scholar-form/index.tsx
index 030571b1a..ce320b309 100644
--- a/web/src/pages/flow/form/google-scholar-form/index.tsx
+++ b/web/src/pages/flow/form/google-scholar-form/index.tsx
@@ -5,6 +5,7 @@ import dayjs from 'dayjs';
import { useCallback, useMemo } from 'react';
import { useBuildSortOptions } from '../../form-hooks';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
const YearPicker = ({
onChange,
@@ -31,7 +32,7 @@ const YearPicker = ({
return ;
};
-const GoogleScholarForm = ({ onValuesChange, form }: IOperatorForm) => {
+const GoogleScholarForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const options = useBuildSortOptions();
@@ -39,12 +40,12 @@ const GoogleScholarForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
{
+const Jin10Form = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const jin10TypeOptions = useMemo(() => {
@@ -59,12 +60,12 @@ const Jin10Form = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/keyword-extract-form/index.tsx b/web/src/pages/flow/form/keyword-extract-form/index.tsx
index c88612c54..f4265b5fc 100644
--- a/web/src/pages/flow/form/keyword-extract-form/index.tsx
+++ b/web/src/pages/flow/form/keyword-extract-form/index.tsx
@@ -4,8 +4,9 @@ import { useTranslate } from '@/hooks/common-hooks';
import { Form } from 'antd';
import { useSetLlmSetting } from '../../hooks';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
-const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
+const KeywordExtractForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
useSetLlmSetting(form);
@@ -13,12 +14,12 @@ const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
{
+const PubMedForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
return (
{
+const QWeatherForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
const qWeatherLangOptions = useMemo(() => {
return QWeatherLangOptions.map((x) => ({
@@ -49,12 +50,12 @@ const QWeatherForm = ({ onValuesChange, form }: IOperatorForm) => {
return (
diff --git a/web/src/pages/flow/form/retrieval-form/index.tsx b/web/src/pages/flow/form/retrieval-form/index.tsx
index d9cbfb28f..df4b7083f 100644
--- a/web/src/pages/flow/form/retrieval-form/index.tsx
+++ b/web/src/pages/flow/form/retrieval-form/index.tsx
@@ -6,6 +6,7 @@ import { useTranslate } from '@/hooks/common-hooks';
import type { FormProps } from 'antd';
import { Form, Input } from 'antd';
import { IOperatorForm } from '../../interface';
+import DynamicInputVariable from '../components/dynamic-input-variable';
type FieldType = {
top_n?: number;
@@ -19,7 +20,7 @@ const onFinishFailed: FormProps['onFinishFailed'] = (errorInfo) => {
console.log('Failed:', errorInfo);
};
-const RetrievalForm = ({ onValuesChange, form }: IOperatorForm) => {
+const RetrievalForm = ({ onValuesChange, form, node }: IOperatorForm) => {
const { t } = useTranslate('flow');
return (