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
2edef89a
Commit
2edef89a
authored
Mar 13, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: handle system var
parent
cbe7de58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
19 deletions
+40
-19
utils.ts
...ponents/workflow/nodes/_base/components/variable/utils.ts
+11
-0
panel.tsx
web/app/components/workflow/nodes/start/panel.tsx
+23
-19
use-config.ts
web/app/components/workflow/nodes/start/use-config.ts
+6
-0
No files found.
web/app/components/workflow/nodes/_base/components/variable/utils.ts
View file @
2edef89a
...
@@ -39,6 +39,17 @@ const formatItem = (item: any, isChatMode: boolean): NodeOutPutVar => {
...
@@ -39,6 +39,17 @@ const formatItem = (item: any, isChatMode: boolean): NodeOutPutVar => {
type
:
inputVarTypeToVarType
(
v
.
type
),
type
:
inputVarTypeToVarType
(
v
.
type
),
}
}
})
})
if
(
isChatMode
)
{
res
.
vars
.
push
({
variable
:
'sys.query'
,
type
:
VarType
.
string
,
})
res
.
vars
.
push
({
variable
:
'sys.files'
,
type
:
VarType
.
arrayFile
,
})
}
break
break
}
}
...
...
web/app/components/workflow/nodes/start/panel.tsx
View file @
2edef89a
...
@@ -20,6 +20,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
...
@@ -20,6 +20,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
readOnly
=
false
const
readOnly
=
false
const
{
const
{
isChatMode
,
inputs
,
inputs
,
isShowAddVarModal
,
isShowAddVarModal
,
showAddVarModal
,
showAddVarModal
,
...
@@ -50,16 +51,17 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
...
@@ -50,16 +51,17 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
</
Field
>
</
Field
>
</
div
>
</
div
>
<
Split
/>
<
Split
/>
{
isChatMode
&&
(
<
div
className=
'px-4 pt-4 pb-2'
>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
title=
{
t
(
`${i18nPrefix}.builtInVar`
)
!
}
>
<
OutputVars
title=
{
t
(
`${i18nPrefix}.builtInVar`
)
!
}
>
<>
<>
<
VarItem
<
VarItem
name=
'sys.query'
name=
'sys.query'
type=
'string'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.query`
)
}
description=
{
t
(
`${i18nPrefix}.outputVars.query`
)
}
/>
/>
<
VarItem
{
/* Now not support sys.memories */
}
{
/* <VarItem
name='sys.memories'
name='sys.memories'
type='array[Object]'
type='array[Object]'
description={t(`${i18nPrefix}.outputVars.memories.des`)}
description={t(`${i18nPrefix}.outputVars.memories.des`)}
...
@@ -75,15 +77,17 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
...
@@ -75,15 +77,17 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
description: t(`${i18nPrefix}.outputVars.memories.content`),
description: t(`${i18nPrefix}.outputVars.memories.content`),
},
},
]}
]}
/>
/> */
}
<
VarItem
<
VarItem
name=
'sys.files'
name=
'sys.files'
type=
'string'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.files`
)
}
description=
{
t
(
`${i18nPrefix}.outputVars.files`
)
}
/>
/>
</>
</>
</
OutputVars
>
</
OutputVars
>
</
div
>
</
div
>
)
}
{
isShowAddVarModal
&&
(
{
isShowAddVarModal
&&
(
<
ConfigVarModal
<
ConfigVarModal
isCreate
isCreate
...
...
web/app/components/workflow/nodes/start/use-config.ts
View file @
2edef89a
...
@@ -4,8 +4,13 @@ import { useBoolean } from 'ahooks'
...
@@ -4,8 +4,13 @@ import { useBoolean } from 'ahooks'
import
type
{
StartNodeType
}
from
'./types'
import
type
{
StartNodeType
}
from
'./types'
import
type
{
InputVar
}
from
'@/app/components/workflow/types'
import
type
{
InputVar
}
from
'@/app/components/workflow/types'
import
useNodeCrud
from
'@/app/components/workflow/nodes/_base/hooks/use-node-crud'
import
useNodeCrud
from
'@/app/components/workflow/nodes/_base/hooks/use-node-crud'
import
{
useIsChatMode
,
}
from
'@/app/components/workflow/hooks'
const
useConfig
=
(
id
:
string
,
payload
:
StartNodeType
)
=>
{
const
useConfig
=
(
id
:
string
,
payload
:
StartNodeType
)
=>
{
const
isChatMode
=
useIsChatMode
()
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
StartNodeType
>
(
id
,
payload
)
const
{
inputs
,
setInputs
}
=
useNodeCrud
<
StartNodeType
>
(
id
,
payload
)
const
[
isShowAddVarModal
,
{
const
[
isShowAddVarModal
,
{
...
@@ -27,6 +32,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
...
@@ -27,6 +32,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
setInputs
(
newInputs
)
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
},
[
inputs
,
setInputs
])
return
{
return
{
isChatMode
,
inputs
,
inputs
,
isShowAddVarModal
,
isShowAddVarModal
,
showAddVarModal
,
showAddVarModal
,
...
...
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