http request node support template variable

This commit is contained in:
takatost
2024-03-29 20:54:08 +08:00
parent 142d1be4f8
commit de3b7e8815
9 changed files with 90 additions and 168 deletions

View File

@ -278,21 +278,9 @@ class WorkflowConverter:
token=api_based_extension.api_key
)
http_request_variables = []
inputs = {}
for v in variables:
http_request_variables.append({
"variable": v.variable,
"value_selector": ["start", v.variable]
})
inputs[v.variable] = '{{' + v.variable + '}}'
if app_model.mode == AppMode.CHAT.value:
http_request_variables.append({
"variable": "_query",
"value_selector": ["sys", ".query"]
})
inputs[v.variable] = '{{#start.' + v.variable + '#}}'
request_body = {
'point': APIBasedExtensionPoint.APP_EXTERNAL_DATA_TOOL_QUERY.value,
@ -313,7 +301,6 @@ class WorkflowConverter:
"data": {
"title": f"HTTP REQUEST {api_based_extension.name}",
"type": NodeType.HTTP_REQUEST.value,
"variables": http_request_variables,
"method": "post",
"url": api_based_extension.api_endpoint,
"authorization": {