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
68fa81ec
Commit
68fa81ec
authored
Mar 14, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: change tool input types
parent
c051c891
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
11 deletions
+14
-11
item.tsx
web/app/components/workflow/block-selector/tools/item.tsx
+1
-0
types.ts
web/app/components/workflow/block-selector/types.ts
+1
-0
use-config.ts
web/app/components/workflow/nodes/http/use-config.ts
+1
-0
default.ts
web/app/components/workflow/nodes/tool/default.ts
+2
-2
node.tsx
web/app/components/workflow/nodes/tool/node.tsx
+1
-1
panel.tsx
web/app/components/workflow/nodes/tool/panel.tsx
+2
-2
types.ts
web/app/components/workflow/nodes/tool/types.ts
+2
-2
use-config.ts
web/app/components/workflow/nodes/tool/use-config.ts
+4
-4
No files found.
web/app/components/workflow/block-selector/tools/item.tsx
View file @
68fa81ec
...
@@ -106,6 +106,7 @@ const Item = ({
...
@@ -106,6 +106,7 @@ const Item = ({
provider_type
:
data
.
type
,
provider_type
:
data
.
type
,
provider_name
:
data
.
name
,
provider_name
:
data
.
name
,
tool_name
:
tool
.
name
,
tool_name
:
tool
.
name
,
tool_label
:
tool
.
label
[
language
],
title
:
tool
.
label
[
language
],
title
:
tool
.
label
[
language
],
})
}
})
}
>
>
...
...
web/app/components/workflow/block-selector/types.ts
View file @
68fa81ec
...
@@ -30,5 +30,6 @@ export type ToolDefaultValue = {
...
@@ -30,5 +30,6 @@ export type ToolDefaultValue = {
provider_type
:
string
provider_type
:
string
provider_name
:
string
provider_name
:
string
tool_name
:
string
tool_name
:
string
tool_label
:
string
title
:
string
title
:
string
}
}
web/app/components/workflow/nodes/http/use-config.ts
View file @
68fa81ec
...
@@ -10,6 +10,7 @@ import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-s
...
@@ -10,6 +10,7 @@ import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-s
const
useConfig
=
(
id
:
string
,
payload
:
HttpNodeType
)
=>
{
const
useConfig
=
(
id
:
string
,
payload
:
HttpNodeType
)
=>
{
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
HttpNodeType
>
(
id
,
payload
)
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
HttpNodeType
>
(
id
,
payload
)
// console.log(inputs)
const
{
handleVarListChange
,
handleAddVariable
}
=
useVarList
<
HttpNodeType
>
({
const
{
handleVarListChange
,
handleAddVariable
}
=
useVarList
<
HttpNodeType
>
({
inputs
,
inputs
,
setInputs
,
setInputs
,
...
...
web/app/components/workflow/nodes/tool/default.ts
View file @
68fa81ec
...
@@ -3,8 +3,8 @@ import type { ToolNodeType } from './types'
...
@@ -3,8 +3,8 @@ import type { ToolNodeType } from './types'
const
nodeDefault
:
NodeDefault
<
ToolNodeType
>
=
{
const
nodeDefault
:
NodeDefault
<
ToolNodeType
>
=
{
defaultValue
:
{
defaultValue
:
{
tool_
input
s
:
[],
tool_
parameter
s
:
[],
tool_
parameter
s
:
{},
tool_
configuration
s
:
{},
},
},
getAvailablePrevNodes
()
{
getAvailablePrevNodes
()
{
return
[]
return
[]
...
...
web/app/components/workflow/nodes/tool/node.tsx
View file @
68fa81ec
...
@@ -8,7 +8,7 @@ import type { NodeProps } from '@/app/components/workflow/types'
...
@@ -8,7 +8,7 @@ import type { NodeProps } from '@/app/components/workflow/types'
const
Node
:
FC
<
NodeProps
<
ToolNodeType
>>
=
({
const
Node
:
FC
<
NodeProps
<
ToolNodeType
>>
=
({
data
,
data
,
})
=>
{
})
=>
{
const
{
tool_inputs
}
=
data
const
{
tool_
parameters
:
tool_
inputs
}
=
data
return
(
return
(
<
div
className=
'px-3'
>
<
div
className=
'px-3'
>
...
...
web/app/components/workflow/nodes/tool/panel.tsx
View file @
68fa81ec
...
@@ -47,7 +47,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
...
@@ -47,7 +47,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
runResult
,
runResult
,
}
=
useConfig
(
id
,
data
)
}
=
useConfig
(
id
,
data
)
//
console.log(inputs)
console
.
log
(
inputs
)
if
(
isLoading
)
{
if
(
isLoading
)
{
return
<
div
className=
'flex h-[200px] items-center justify-center'
>
return
<
div
className=
'flex h-[200px] items-center justify-center'
>
...
@@ -80,7 +80,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
...
@@ -80,7 +80,7 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
readOnly=
{
readOnly
}
readOnly=
{
readOnly
}
nodeId=
{
id
}
nodeId=
{
id
}
schema=
{
toolInputVarSchema
as
any
}
schema=
{
toolInputVarSchema
as
any
}
value=
{
inputs
.
tool_
input
s
}
value=
{
inputs
.
tool_
parameter
s
}
onChange=
{
setInputVar
}
onChange=
{
setInputVar
}
/>
/>
</
Field
>
</
Field
>
...
...
web/app/components/workflow/nodes/tool/types.ts
View file @
68fa81ec
...
@@ -18,6 +18,6 @@ export type ToolNodeType = CommonNodeType & {
...
@@ -18,6 +18,6 @@ export type ToolNodeType = CommonNodeType & {
provider_name
:
string
provider_name
:
string
tool_name
:
string
tool_name
:
string
tool_label
:
string
tool_label
:
string
tool_
input
s
:
ToolVarInput
[]
tool_
parameter
s
:
ToolVarInput
[]
tool_
parameter
s
:
Record
<
string
,
any
>
tool_
configuration
s
:
Record
<
string
,
any
>
}
}
web/app/components/workflow/nodes/tool/use-config.ts
View file @
68fa81ec
...
@@ -23,8 +23,8 @@ const useConfig = (id: string, payload: ToolNodeType) => {
...
@@ -23,8 +23,8 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const
setToolsMap
=
useStore
(
s
=>
s
.
setToolsMap
)
const
setToolsMap
=
useStore
(
s
=>
s
.
setToolsMap
)
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
ToolNodeType
>
(
id
,
payload
)
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
ToolNodeType
>
(
id
,
payload
)
const
toolInputs
=
inputs
.
tool_
input
s
const
toolInputs
=
inputs
.
tool_
parameter
s
const
{
provider_id
,
provider_name
,
provider_type
,
tool_name
,
tool_parameters
}
=
inputs
const
{
provider_id
,
provider_name
,
provider_type
,
tool_name
,
tool_
configurations
:
tool_
parameters
}
=
inputs
const
isBuiltIn
=
provider_type
===
CollectionType
.
builtIn
const
isBuiltIn
=
provider_type
===
CollectionType
.
builtIn
const
[
currCollection
,
setCurrCollection
]
=
useState
<
Collection
|
null
|
undefined
>
(
null
)
const
[
currCollection
,
setCurrCollection
]
=
useState
<
Collection
|
null
|
undefined
>
(
null
)
const
fetchCurrCollection
=
useCallback
(
async
()
=>
{
const
fetchCurrCollection
=
useCallback
(
async
()
=>
{
...
@@ -72,7 +72,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
...
@@ -72,7 +72,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const
setToolSettingValue
=
useCallback
((
value
:
Record
<
string
,
any
>
)
=>
{
const
setToolSettingValue
=
useCallback
((
value
:
Record
<
string
,
any
>
)
=>
{
setInputs
({
setInputs
({
...
inputs
,
...
inputs
,
tool_
parameter
s
:
value
,
tool_
configuration
s
:
value
,
})
})
},
[
inputs
,
setInputs
])
},
[
inputs
,
setInputs
])
...
@@ -81,7 +81,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
...
@@ -81,7 +81,7 @@ const useConfig = (id: string, payload: ToolNodeType) => {
const
setInputVar
=
useCallback
((
value
:
ToolVarInput
[])
=>
{
const
setInputVar
=
useCallback
((
value
:
ToolVarInput
[])
=>
{
setInputs
({
setInputs
({
...
inputs
,
...
inputs
,
tool_
input
s
:
value
,
tool_
parameter
s
:
value
,
})
})
},
[
inputs
,
setInputs
])
},
[
inputs
,
setInputs
])
...
...
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