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 data type invoke (#5126)
so9511de7599e5dd
diff --git a/agent/component/exesql.py b/agent/component/exesql.pyindex ea04947e23..d61239d4cb 100644--- a/agent/component/exesql.py+++ b/agent/component/exesql.py@@ -79,7 +79,6 @@ class ExeSQL(Generate, ABC):ans = self.get_input()ans = "".join([str(a) for a in ans["content"]]) if "content" in ans else ""ans = self._refactor(ans)- logging.info("db_type: ", self._param.db_type)if self._param.db_type in ["mysql", "mariadb"]:db = pymysql.connect(db=self._param.database, user=self._param.username, host=self._param.host,port=self._param.port, password=self._param.password)@@ -128,7 +127,6 @@ class ExeSQL(Generate, ABC):single_sql = self._refactor(single_sql)if self._loop > self._param.loop:sql_res.append({"content": "Can't query the correct data via SQL statement."})- # raise Exception("Maximum loop time exceeds. Can't query the correct data via SQL statement.")db.close()if not sql_res:return ExeSQL.be_output("")diff --git a/agent/component/invoke.py b/agent/component/invoke.pyindex 22a279cef7..c2bd58bd43 100644--- a/agent/component/invoke.py+++ b/agent/component/invoke.py@@ -35,12 +35,14 @@ class InvokeParam(ComponentParamBase):self.url = ""self.timeout = 60self.clean_html = False+ self.datatype = "json" # New parameter to determine data posting typedef check(self):self.check_valid_value(self.method.lower(), "Type of content from the crawler", ['get', 'post', 'put'])self.check_empty(self.url, "End point URL")self.check_positive_integer(self.timeout, "Timeout time in second")self.check_boolean(self.clean_html, "Clean HTML")+ self.check_valid_value(self.datatype.lower(), "Data post type", ['json', 'formdata']) # Check for valid datapost valueclass Invoke(ComponentBase, ABC):@@ -94,22 +96,36 @@ class Invoke(ComponentBase, ABC):return Invoke.be_output(response.text)if method == 'put':- response = requests.put(url=url,- json=args,- headers=headers,- proxies=proxies,- timeout=self._param.timeout)+ if self._param.datatype.lower() == 'json':+ response = requests.put(url=url,+ json=args,+ headers=headers,+ proxies=proxies,+ timeout=self._param.timeout)+ else:+ response = requests.put(url=url,+ data=args,+ headers=headers,+ proxies=proxies,+ timeout=self._param.timeout)if self._param.clean_html:sections = HtmlParser()(None, response.content)return Invoke.be_output("\n".join(sections))return Invoke.be_output(response.text)if method == 'post':- response = requests.post(url=url,- json=args,- headers=headers,- proxies=proxies,- timeout=self._param.timeout)+ if self._param.datatype.lower() == 'json':+ response = requests.post(url=url,+ json=args,+ headers=headers,+ proxies=proxies,+ timeout=self._param.timeout)+ else:+ response = requests.post(url=url,+ data=args,+ headers=headers,+ proxies=proxies,+ timeout=self._param.timeout)if self._param.clean_html:sections = HtmlParser()(None, response.content)return Invoke.be_output("\n".join(sections))diff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex af0e31b5b4..27fc7c0bbd 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -528,6 +528,7 @@ This auto-tag feature enhances retrieval by adding another layer of domain-speci'Allows sentence rewriting with the specified language or defaults to the latest question if not selected.',avatarHidden: 'Hide avatar',locale: 'Locale',+ selectLanguage: 'Select a language',reasoning: 'Reasoning',reasoningTip:'It will trigger reasoning process like Deepseek-R1/OpenAI o1. Integrates an agentic search process into the reasoning workflow, allowing models itself to dynamically retrieve external knowledge whenever they encounter uncertain information.',@@ -845,7 +846,7 @@ This auto-tag feature enhances retrieval by adding another layer of domain-specibingDescription:'A component that searches from https://www.bing.com/, allowing you to specify the number of search results using TopN. It supplements the existing knowledge bases. Please note that this requires an API key from microsoft.com.',apiKey: 'API KEY',- country: 'Country&Region',+ country: 'Country & Region',language: 'Language',googleScholar: 'Google Scholar',googleScholarDescription:@@ -1187,6 +1188,7 @@ This delimiter is used to split the input text into several text pieces echo ofaddCategory: 'Add category',categoryName: 'Category name',nextStep: 'Next step',+ datatype: 'MINE type of the HTTP request',insertVariableTip: `Enter / Insert variables`,},footer: {diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsxindex 132f8ff741..5a8df53f4e 100644--- a/web/src/pages/flow/constant.tsx+++ b/web/src/pages/flow/constant.tsx@@ -606,6 +606,7 @@ export const initialInvokeValues = {}`,proxy: 'http://',clean_html: false,+ datatype: 'json',};export const initialTemplateValues = {diff --git a/web/src/pages/flow/form/invoke-form/index.tsx b/web/src/pages/flow/form/invoke-form/index.tsxindex 521f1c95f6..a62723ebce 100644--- a/web/src/pages/flow/form/invoke-form/index.tsx+++ b/web/src/pages/flow/form/invoke-form/index.tsx@@ -69,6 +69,15 @@ const InvokeForm = ({ onValuesChange, form, node }: IOperatorForm) => {><Switch /></Form.Item>+ <Form.Item name={'datatype'} label={t('flow.datatype')}>+ <Select+ options={[+ { value: 'json', label: 'application/json' },+ { value: 'formdata', label: 'multipart/form-data' },+ ]}+ allowClear={true}+ ></Select>+ </Form.Item><DynamicVariablesForm node={node}></DynamicVariablesForm></Form></>