Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
0a12ddcb
Unverified
Commit
0a12ddcb
authored
Mar 13, 2024
by
Yeuoly
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/workflow-backend' into deploy/dev
parents
5ab12077
e80315f5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
6 deletions
+55
-6
.env.example
api/.env.example
+2
-2
entities.py
api/core/workflow/nodes/http_request/entities.py
+15
-2
if_else_node.py
api/core/workflow/nodes/if_else/if_else_node.py
+2
-2
test_http.py
api/tests/integration_tests/workflow/nodes/test_http.py
+30
-0
docker-compose.middleware.yaml
docker/docker-compose.middleware.yaml
+3
-0
docker-compose.yaml
docker/docker-compose.yaml
+3
-0
No files found.
api/.env.example
View file @
0a12ddcb
...
...
@@ -134,5 +134,5 @@ SSRF_PROXY_HTTPS_URL=
BATCH_UPLOAD_LIMIT=10
# CODE EXECUTION CONFIGURATION
CODE_EXECUTION_ENDPOINT=
CODE_EXECUTION_API_KEY=
CODE_EXECUTION_ENDPOINT=
http://127.0.0.1:8194
CODE_EXECUTION_API_KEY=
dify-sandbox
api/core/workflow/nodes/http_request/entities.py
View file @
0a12ddcb
from
typing
import
Literal
,
Optional
,
Union
from
pydantic
import
BaseModel
from
pydantic
import
BaseModel
,
validator
from
core.workflow.entities.base_node_data_entities
import
BaseNodeData
from
core.workflow.entities.variable_entities
import
VariableSelector
...
...
@@ -17,7 +17,20 @@ class HttpRequestNodeData(BaseNodeData):
header
:
Union
[
None
,
str
]
type
:
Literal
[
'no-auth'
,
'api-key'
]
config
:
Config
config
:
Optional
[
Config
]
@
validator
(
'config'
,
always
=
True
,
pre
=
True
)
def
check_config
(
cls
,
v
,
values
):
"""
Check config, if type is no-auth, config should be None, otherwise it should be a dict.
"""
if
values
[
'type'
]
==
'no-auth'
:
return
None
else
:
if
not
v
or
not
isinstance
(
v
,
dict
):
raise
ValueError
(
'config should be a dict'
)
return
v
class
Body
(
BaseModel
):
type
:
Literal
[
None
,
'form-data'
,
'x-www-form-urlencoded'
,
'raw'
,
'json'
]
...
...
api/core/workflow/nodes/if_else/if_else_node.py
View file @
0a12ddcb
...
...
@@ -95,7 +95,7 @@ class IfElseNode(BaseNode):
return
NodeRunResult
(
status
=
WorkflowNodeExecutionStatus
.
FAILED
,
inputs
=
node_inputs
,
process_data
s
=
process_datas
,
process_data
=
process_datas
,
error
=
str
(
e
)
)
...
...
@@ -107,7 +107,7 @@ class IfElseNode(BaseNode):
return
NodeRunResult
(
status
=
WorkflowNodeExecutionStatus
.
SUCCEEDED
,
inputs
=
node_inputs
,
process_data
s
=
process_datas
,
process_data
=
process_datas
,
edge_source_handle
=
"false"
if
not
compare_result
else
"true"
,
outputs
=
{
"result"
:
compare_result
...
...
api/tests/integration_tests/workflow/nodes/test_http.py
View file @
0a12ddcb
...
...
@@ -54,6 +54,36 @@ def test_get(setup_http_mock):
assert
'api-key: Basic ak-xxx'
in
data
assert
'X-Header: 123'
in
data
@
pytest
.
mark
.
parametrize
(
'setup_http_mock'
,
[[
'none'
]],
indirect
=
True
)
def
test_no_auth
(
setup_http_mock
):
node
=
HttpRequestNode
(
config
=
{
'id'
:
'1'
,
'data'
:
{
'title'
:
'http'
,
'desc'
:
''
,
'variables'
:
[{
'variable'
:
'args1'
,
'value_selector'
:
[
'1'
,
'123'
,
'args1'
],
}],
'method'
:
'get'
,
'url'
:
'http://example.com'
,
'authorization'
:
{
'type'
:
'no-auth'
,
'config'
:
None
,
},
'headers'
:
'X-Header:123'
,
'params'
:
'A:b'
,
'body'
:
None
,
}
},
**
BASIC_NODE_DATA
)
result
=
node
.
run
(
pool
)
data
=
result
.
process_data
.
get
(
'request'
,
''
)
assert
'?A=b'
in
data
assert
'X-Header: 123'
in
data
@
pytest
.
mark
.
parametrize
(
'setup_http_mock'
,
[[
'none'
]],
indirect
=
True
)
def
test_template
(
setup_http_mock
):
node
=
HttpRequestNode
(
config
=
{
...
...
docker/docker-compose.middleware.yaml
View file @
0a12ddcb
...
...
@@ -55,9 +55,12 @@ services:
sandbox
:
image
:
langgenius/dify-sandbox:latest
restart
:
always
cap_add
:
-
SYS_ADMIN
environment
:
# The DifySandbox configurations
API_KEY
:
dify-sandbox
GIN_MODE
:
'
release'
ports
:
-
"
8194:8194"
...
...
docker/docker-compose.yaml
View file @
0a12ddcb
...
...
@@ -293,9 +293,12 @@ services:
sandbox
:
image
:
langgenius/dify-sandbox:latest
restart
:
always
cap_add
:
-
SYS_ADMIN
environment
:
# The DifySandbox configurations
API_KEY
:
dify-sandbox
GIN_MODE
:
release
ports
:
-
"
8194:8194"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment