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
49ce9d22
Commit
49ce9d22
authored
Mar 08, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: http support debug and remove mock init debug data
parent
c20c9b53
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
15 deletions
+78
-15
form-item.tsx
...flow/nodes/_base/components/before-run-form/form-item.tsx
+1
-1
use-one-step-run.ts
...components/workflow/nodes/_base/hooks/use-one-step-run.ts
+6
-2
use-config.ts
web/app/components/workflow/nodes/code/use-config.ts
+1
-4
panel.tsx
web/app/components/workflow/nodes/http/panel.tsx
+27
-0
use-config.ts
web/app/components/workflow/nodes/http/use-config.ts
+40
-0
use-config.ts
...mponents/workflow/nodes/knowledge-retrieval/use-config.ts
+1
-1
use-config.ts
web/app/components/workflow/nodes/llm/use-config.ts
+0
-2
use-config.ts
...mponents/workflow/nodes/question-classifier/use-config.ts
+1
-1
use-config.ts
...omponents/workflow/nodes/template-transform/use-config.ts
+1
-4
No files found.
web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
View file @
49ce9d22
...
...
@@ -42,7 +42,7 @@ const FormItem: FC<Props> = ({
},
[
value
,
onChange
])
return
(
<
div
className=
'flex justify-between items-start'
>
{
type
!==
InputVarType
.
contexts
&&
<
div
className=
'shrink-0 w-[96px] pr-1 h-8 leading-8 text-[13px] font-medium text-gray-700
capitalize
truncate'
>
{
payload
.
label
}
</
div
>
}
{
type
!==
InputVarType
.
contexts
&&
<
div
className=
'shrink-0 w-[96px] pr-1 h-8 leading-8 text-[13px] font-medium text-gray-700 truncate'
>
{
payload
.
label
}
</
div
>
}
<
div
className=
'w-0 grow'
>
{
type
===
InputVarType
.
textInput
&&
(
...
...
web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts
View file @
49ce9d22
...
...
@@ -7,10 +7,11 @@ type Params<T> = {
id
:
string
data
:
CommonNodeType
<
T
>
defaultRunInputData
:
Record
<
string
,
any
>
isInvalid
?:
()
=>
boolean
}
const
useOneStepRun
=
<
T
>
({
id
,
data
,
defaultRunInputData
}:
Params
<
T
>
)
=>
{
const
{
handleNodeDataUpdate
}
=
useWorkflow
()
const
useOneStepRun
=
<
T
>
({
id
,
data
,
defaultRunInputData
,
isInvalid
=
()
=>
true
}:
Params
<
T
>
)
=>
{
const
{
handleNodeDataUpdate
}
:
{
handleNodeDataUpdate
:
(
data
:
any
)
=>
void
}
=
useWorkflow
()
const
isShowSingleRun
=
data
.
_isSingleRun
const
hideSingleRun
=
()
=>
{
handleNodeDataUpdate
({
...
...
@@ -24,6 +25,9 @@ const useOneStepRun = <T>({ id, data, defaultRunInputData }: Params<T>) => {
const
[
runningStatus
,
setRunningStatus
]
=
useState
(
'un started'
)
const
handleRun
=
()
=>
{
if
(
isInvalid
())
return
setRunningStatus
(
'running'
)
}
...
...
web/app/components/workflow/nodes/code/use-config.ts
View file @
49ce9d22
...
...
@@ -45,10 +45,7 @@ const useConfig = (id: string, payload: CodeNodeType) => {
}
=
useOneStepRun
<
CodeNodeType
>
({
id
,
data
:
inputs
,
defaultRunInputData
:
{
name
:
'Joel'
,
age
:
'18'
,
},
defaultRunInputData
:
{},
})
const
varInputs
=
toVarInputs
(
inputs
.
variables
)
...
...
web/app/components/workflow/nodes/http/panel.tsx
View file @
49ce9d22
...
...
@@ -14,6 +14,8 @@ import Split from '@/app/components/workflow/nodes/_base/components/split'
import
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
import
{
Settings01
}
from
'@/app/components/base/icons/src/vender/line/general'
import
type
{
NodePanelProps
}
from
'@/app/components/workflow/types'
import
BeforeRunForm
from
'@/app/components/workflow/nodes/_base/components/before-run-form'
const
i18nPrefix
=
'workflow.nodes.http'
const
Panel
:
FC
<
NodePanelProps
<
HttpNodeType
>>
=
({
...
...
@@ -44,6 +46,15 @@ const Panel: FC<NodePanelProps<HttpNodeType>> = ({
showAuthorization
,
hideAuthorization
,
setAuthorization
,
// single run
isShowSingleRun
,
hideSingleRun
,
runningStatus
,
handleRun
,
handleStop
,
varInputs
,
inputVarValues
,
setInputVarValues
,
}
=
useConfig
(
id
,
data
)
return
(
...
...
@@ -148,6 +159,22 @@ const Panel: FC<NodePanelProps<HttpNodeType>> = ({
</>
</
OutputVars
>
</
div
>
{
isShowSingleRun
&&
(
<
BeforeRunForm
nodeName=
{
inputs
.
title
}
onHide=
{
hideSingleRun
}
forms=
{
[
{
inputs
:
varInputs
,
values
:
inputVarValues
,
onChange
:
setInputVarValues
,
},
]
}
runningStatus=
{
runningStatus
}
onRun=
{
handleRun
}
onStop=
{
handleStop
}
/>
)
}
</
div
>
)
}
...
...
web/app/components/workflow/nodes/http/use-config.ts
View file @
49ce9d22
...
...
@@ -5,6 +5,7 @@ import useVarList from '../_base/hooks/use-var-list'
import
type
{
Authorization
,
Body
,
HttpNodeType
,
Method
}
from
'./types'
import
useKeyValueList
from
'./hooks/use-key-value-list'
import
useNodeCrud
from
'@/app/components/workflow/nodes/_base/hooks/use-node-crud'
import
useOneStepRun
from
'@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
const
useConfig
=
(
id
:
string
,
payload
:
HttpNodeType
)
=>
{
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
HttpNodeType
>
(
id
,
payload
)
...
...
@@ -64,6 +65,36 @@ const useConfig = (id: string, payload: HttpNodeType) => {
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
// single run
const
{
isShowSingleRun
,
hideSingleRun
,
toVarInputs
,
runningStatus
,
handleRun
,
handleStop
,
runInputData
,
setRunInputData
,
}
=
useOneStepRun
<
HttpNodeType
>
({
id
,
data
:
inputs
,
defaultRunInputData
:
{},
})
const
varInputs
=
toVarInputs
(
inputs
.
variables
)
const
inputVarValues
=
(()
=>
{
const
vars
:
Record
<
string
,
any
>
=
{}
Object
.
keys
(
runInputData
)
.
forEach
((
key
)
=>
{
vars
[
key
]
=
runInputData
[
key
]
})
return
vars
})()
const
setInputVarValues
=
useCallback
((
newPayload
:
Record
<
string
,
any
>
)
=>
{
setRunInputData
(
newPayload
)
},
[
runInputData
,
setRunInputData
])
return
{
inputs
,
handleVarListChange
,
...
...
@@ -89,6 +120,15 @@ const useConfig = (id: string, payload: HttpNodeType) => {
showAuthorization
,
hideAuthorization
,
setAuthorization
,
// single run
isShowSingleRun
,
hideSingleRun
,
runningStatus
,
handleRun
,
handleStop
,
varInputs
,
inputVarValues
,
setInputVarValues
,
}
}
...
...
web/app/components/workflow/nodes/knowledge-retrieval/use-config.ts
View file @
49ce9d22
...
...
@@ -68,7 +68,7 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {
id
,
data
:
inputs
,
defaultRunInputData
:
{
query
:
'
What is the capital of France?
'
,
query
:
''
,
},
})
...
...
web/app/components/workflow/nodes/llm/use-config.ts
View file @
49ce9d22
...
...
@@ -103,8 +103,6 @@ const useConfig = (id: string, payload: LLMNodeType) => {
id
,
data
:
inputs
,
defaultRunInputData
:
{
'name'
:
'Joel'
,
'age'
:
'18'
,
'#context#'
:
[
RETRIEVAL_OUTPUT_STRUCT
],
'#vision#'
:
[],
},
...
...
web/app/components/workflow/nodes/question-classifier/use-config.ts
View file @
49ce9d22
...
...
@@ -66,7 +66,7 @@ const useConfig = (id: string, payload: QuestionClassifierNodeType) => {
id
,
data
:
inputs
,
defaultRunInputData
:
{
query
:
'
Negative or positive sentiment?
'
,
query
:
''
,
},
})
...
...
web/app/components/workflow/nodes/template-transform/use-config.ts
View file @
49ce9d22
...
...
@@ -32,10 +32,7 @@ const useConfig = (id: string, payload: TemplateTransformNodeType) => {
}
=
useOneStepRun
<
TemplateTransformNodeType
>
({
id
,
data
:
inputs
,
defaultRunInputData
:
{
name
:
'Joel'
,
age
:
'18'
,
},
defaultRunInputData
:
{},
})
const
varInputs
=
toVarInputs
(
inputs
.
variables
)
...
...
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