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
9bb98072
Commit
9bb98072
authored
Feb 21, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: http node struct
parent
8b8fdb48
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
4 deletions
+161
-4
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+2
-2
mock.ts
web/app/components/workflow/nodes/http/mock.ts
+25
-0
panel.tsx
web/app/components/workflow/nodes/http/panel.tsx
+77
-1
types.ts
web/app/components/workflow/nodes/http/types.ts
+13
-0
use-config.ts
web/app/components/workflow/nodes/http/use-config.ts
+20
-0
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+0
-1
workflow.en.ts
web/i18n/lang/workflow.en.ts
+12
-0
workflow.zh.ts
web/i18n/lang/workflow.zh.ts
+12
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
9bb98072
...
...
@@ -46,9 +46,9 @@ const Page: FC = () => {
/*
* TODO: for debug.
* 2 directAnswer 3: llm 5: questionClassifier
* 7 Code, 8 TemplateTransform
* 7 Code, 8 TemplateTransform
9 http
*/
selectedNodeId=
'
7
'
selectedNodeId=
'
9
'
/>
</
div
>
)
...
...
web/app/components/workflow/nodes/http/mock.ts
0 → 100644
View file @
9bb98072
import
type
{
HttpNodeType
}
from
'./types'
export
const
mockData
:
HttpNodeType
=
{
title
:
'Test'
,
desc
:
'Test'
,
type
:
'Test'
,
variables
:
[
{
variable
:
'name'
,
value_selector
:
[
'aaa'
,
'name'
],
},
{
variable
:
'age'
,
value_selector
:
[
'bbb'
,
'b'
,
'c'
],
},
],
method
:
'get'
,
url
:
'https://api.dify.com/xx'
,
headers
:
''
,
params
:
''
,
body
:
{
type
:
'json'
,
data
:
''
,
},
}
web/app/components/workflow/nodes/http/panel.tsx
View file @
9bb98072
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
useConfig
from
'./use-config'
import
{
mockData
}
from
'./mock'
import
VarList
from
'@/app/components/workflow/nodes/_base/components/variable/var-list'
import
Field
from
'@/app/components/workflow/nodes/_base/components/field'
import
AddButton
from
'@/app/components/base/button/add-button'
import
Split
from
'@/app/components/workflow/nodes/_base/components/split'
import
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
const
i18nPrefix
=
'workflow.nodes.http'
const
Panel
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
readOnly
=
false
const
{
inputs
,
handleVarListChange
,
handleAddVariable
,
}
=
useConfig
(
mockData
)
return
(
<
div
>
start panel inputs
</
div
>
<
div
className=
'mt-2'
>
<
div
className=
'px-4 pb-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.inputVars`
)
}
operations=
{
<
AddButton
onClick=
{
handleAddVariable
}
/>
}
>
<
VarList
readonly=
{
readOnly
}
list=
{
inputs
.
variables
}
onChange=
{
handleVarListChange
}
/>
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.api`
)
}
>
API
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.headers`
)
}
>
headers
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.params`
)
}
>
params
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.body`
)
}
>
body
</
Field
>
</
div
>
<
Split
/>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
>
<>
<
VarItem
name=
'body'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.body`
)
}
/>
<
VarItem
name=
'status_code'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.statusCode`
)
}
/>
<
VarItem
name=
'headers'
type=
'sting'
description=
{
t
(
`${i18nPrefix}.outputVars.headers`
)
}
/>
</>
</
OutputVars
>
</
div
>
</
div
>
)
}
...
...
web/app/components/workflow/nodes/http/types.ts
0 → 100644
View file @
9bb98072
import
type
{
CommonNodeType
,
Variable
}
from
'@/app/components/workflow/types'
export
type
HttpNodeType
=
CommonNodeType
&
{
variables
:
Variable
[]
method
:
string
url
:
string
headers
:
string
params
:
string
body
:
{
type
:
string
data
:
string
}
}
web/app/components/workflow/nodes/http/use-config.ts
0 → 100644
View file @
9bb98072
import
{
useState
}
from
'react'
import
useVarList
from
'../_base/hooks/use-var-list'
import
type
{
HttpNodeType
}
from
'./types'
const
useConfig
=
(
initInputs
:
HttpNodeType
)
=>
{
const
[
inputs
,
setInputs
]
=
useState
<
HttpNodeType
>
(
initInputs
)
const
{
handleVarListChange
,
handleAddVariable
}
=
useVarList
<
HttpNodeType
>
({
inputs
,
setInputs
,
})
return
{
inputs
,
handleVarListChange
,
handleAddVariable
,
}
}
export
default
useConfig
web/app/components/workflow/nodes/llm/panel.tsx
View file @
9bb98072
...
...
@@ -107,7 +107,6 @@ const Panel: FC = () => {
</>
</
OutputVars
>
</
div
>
</
div
>
)
}
...
...
web/i18n/lang/workflow.en.ts
View file @
9bb98072
...
...
@@ -19,6 +19,18 @@ const translation = {
usage
:
'Model Usage Information'
,
},
},
http
:
{
inputVars
:
'Input Variables'
,
api
:
'API'
,
headers
:
'Headers'
,
params
:
'Params'
,
body
:
'Body'
,
outputVars
:
{
body
:
'Response Content'
,
statusCode
:
'Response Status Code'
,
headers
:
'Response Header List JSON'
,
},
},
code
:
{
inputVars
:
'Input Variables'
,
outputVars
:
'Output Variables'
,
...
...
web/i18n/lang/workflow.zh.ts
View file @
9bb98072
...
...
@@ -19,6 +19,18 @@ const translation = {
usage
:
'模型用量信息'
,
},
},
http
:
{
inputVars
:
'输入变量'
,
api
:
'API'
,
headers
:
'响应头'
,
params
:
'参数'
,
body
:
'响应内容'
,
outputVars
:
{
body
:
'响应内容'
,
statusCode
:
'响应状态码'
,
headers
:
'响应头列表 JSON'
,
},
},
code
:
{
inputVars
:
'输入变量'
,
outputVars
:
'输出变量'
,
...
...
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