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
b4437ccd
Commit
b4437ccd
authored
Feb 21, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: output lines
parent
65ac4ded
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
158 additions
and
154 deletions
+158
-154
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+1
-1
panel.tsx
web/app/components/workflow/nodes/code/panel.tsx
+29
-24
use-config.ts
...app/components/workflow/nodes/direct-answer/use-config.ts
+5
-17
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+75
-70
node.tsx
...app/components/workflow/nodes/template-transform/node.tsx
+2
-1
panel.tsx
...pp/components/workflow/nodes/template-transform/panel.tsx
+46
-41
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
b4437ccd
...
...
@@ -48,7 +48,7 @@ const Page: FC = () => {
* 2 directAnswer 3: llm 5: questionClassifier
* 7 Code, 8 TemplateTransform
*/
selectedNodeId=
'
8
'
selectedNodeId=
'
3
'
/>
</
div
>
)
...
...
web/app/components/workflow/nodes/code/panel.tsx
View file @
b4437ccd
...
...
@@ -33,32 +33,37 @@ const Panel: FC = () => {
handleCodeLanguageChange
,
}
=
useConfig
(
mockData
)
return
(
<
div
className=
'mt-2 px-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.inputVars`
)
}
operations=
{
<
AddButton
onClick=
{
handleAddVariable
}
/>
}
>
<
VarList
readonly=
{
readOnly
}
list=
{
inputs
.
variables
}
onChange=
{
handleVarListChange
}
/>
</
Field
>
<
Split
/>
<
CodeEditor
title=
{
<
TypeSelector
list=
{
codeLanguages
}
value=
{
inputs
.
code_language
}
onChange=
{
handleCodeLanguageChange
}
<
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
}
/>
}
value=
{
inputs
.
code
}
onChange=
{
handleCodeChange
}
/>
</
Field
>
<
Split
/>
<
CodeEditor
title=
{
<
TypeSelector
list=
{
codeLanguages
}
value=
{
inputs
.
code_language
}
onChange=
{
handleCodeLanguageChange
}
/>
}
value=
{
inputs
.
code
}
onChange=
{
handleCodeChange
}
/>
</
div
>
<
Split
/>
<
div
className=
'px-4 pt-4 pb-2'
>
output var
</
div
>
</
div
>
)
}
...
...
web/app/components/workflow/nodes/direct-answer/use-config.ts
View file @
b4437ccd
import
{
useCallback
,
useState
}
from
'react'
import
produce
from
'immer'
import
type
{
Variable
}
from
'../../types
'
import
useVarList
from
'../_base/hooks/use-var-list
'
import
type
{
DirectAnswerNodeType
}
from
'./types'
const
useConfig
=
(
initInputs
:
DirectAnswerNodeType
)
=>
{
const
[
inputs
,
setInputs
]
=
useState
<
DirectAnswerNodeType
>
(
initInputs
)
// variables
const
handleVarListChange
=
useCallback
((
newList
:
Variable
[])
=>
{
const
newInputs
=
produce
(
inputs
,
(
draft
)
=>
{
draft
.
variables
=
newList
})
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
const
handleAddVariable
=
useCallback
(()
=>
{
const
newInputs
=
produce
(
inputs
,
(
draft
)
=>
{
draft
.
variables
.
push
({
variable
:
''
,
value_selector
:
[],
})
})
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
const
{
handleVarListChange
,
handleAddVariable
}
=
useVarList
<
DirectAnswerNodeType
>
({
inputs
,
setInputs
,
})
const
handleAnswerChange
=
useCallback
((
value
:
string
)
=>
{
const
newInputs
=
produce
(
inputs
,
(
draft
)
=>
{
...
...
web/app/components/workflow/nodes/llm/panel.tsx
View file @
b4437ccd
...
...
@@ -29,80 +29,85 @@ const Panel: FC = () => {
// const isChatMode = modelMode === 'chat'
return
(
<
div
className=
'mt-2 px-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.model`
)
}
>
<
ModelParameterModal
popupClassName=
'!w-[387px]'
isAdvancedMode=
{
true
}
mode=
{
model
?.
mode
}
provider=
{
model
?.
provider
}
completionParams=
{
model
.
completion_params
}
modelId=
{
model
.
name
}
setModel=
{
handleModelChanged
}
onCompletionParamsChange=
{
handleCompletionParamsChange
}
hideDebugWithMultipleModel
debugWithMultipleModel=
{
false
}
/>
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.variables`
)
}
operations=
{
<
AddButton
onClick=
{
handleAddVariable
}
/>
}
>
<
VarList
readonly=
{
readOnly
}
list=
{
inputs
.
variables
}
onChange=
{
handleVarListChange
}
/>
</
Field
>
<
div
className=
'mt-2'
>
<
div
className=
'px-4 pb-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.model`
)
}
>
<
ModelParameterModal
popupClassName=
'!w-[387px]'
isAdvancedMode=
{
true
}
mode=
{
model
?.
mode
}
provider=
{
model
?.
provider
}
completionParams=
{
model
.
completion_params
}
modelId=
{
model
.
name
}
setModel=
{
handleModelChanged
}
onCompletionParamsChange=
{
handleCompletionParamsChange
}
hideDebugWithMultipleModel
debugWithMultipleModel=
{
false
}
/>
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.context`
)
}
operations=
{
<
Switch
defaultValue=
{
inputs
.
context
.
enabled
}
onChange=
{
toggleContextEnabled
}
size=
'md'
<
Field
title=
{
t
(
`${i18nPrefix}.variables`
)
}
operations=
{
<
AddButton
onClick=
{
handleAddVariable
}
/>
}
>
<
VarList
readonly=
{
readOnly
}
list=
{
inputs
.
variables
}
onChange=
{
handleVarListChange
}
/>
}
>
{
inputs
.
context
.
enabled
?
(
<
div
>
Context
</
div
>
)
:
null
}
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.prompt`
)
}
>
Prompt
</
Field
>
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.context`
)
}
operations=
{
<
Switch
defaultValue=
{
inputs
.
context
.
enabled
}
onChange=
{
toggleContextEnabled
}
size=
'md'
/>
}
>
{
inputs
.
context
.
enabled
?
(
<
div
>
Context
</
div
>
)
:
null
}
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.prompt`
)
}
>
Prompt
</
Field
>
<
Split
/>
<
Field
title=
{
t
(
`${i18nPrefix}.vision`
)
}
inline
>
Vision
</
Field
>
</
div
>
<
Split
/>
<
Field
title=
{
t
(
`${i18nPrefix}.vision`
)
}
inline
>
Vision
</
Field
>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
>
<>
<
VarItem
name=
'output'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.output`
)
}
/>
<
VarItem
name=
'usage'
type=
'object'
description=
{
t
(
`${i18nPrefix}.outputVars.usage`
)
}
/>
</>
</
OutputVars
>
</
div
>
<
OutputVars
>
<>
<
VarItem
name=
'output'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.output`
)
}
/>
<
VarItem
name=
'usage'
type=
'object'
description=
{
t
(
`${i18nPrefix}.outputVars.usage`
)
}
/>
</>
</
OutputVars
>
</
div
>
)
}
...
...
web/app/components/workflow/nodes/template-transform/node.tsx
View file @
b4437ccd
...
...
@@ -2,7 +2,8 @@ import type { FC } from 'react'
const
Node
:
FC
=
()
=>
{
return
(
<
div
>
template-transform
</
div
>
// No summary content
<
div
></
div
>
)
}
...
...
web/app/components/workflow/nodes/template-transform/panel.tsx
View file @
b4437ccd
...
...
@@ -23,49 +23,54 @@ const Panel: FC = () => {
handleCodeChange
,
}
=
useConfig
(
mockData
)
return
(
<
div
className=
'mt-2 px-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.inputVars`
)
}
operations=
{
<
AddButton
onClick=
{
handleAddVariable
}
/>
}
>
<
VarList
readonly=
{
readOnly
}
list=
{
inputs
.
variables
}
onChange=
{
handleVarListChange
}
<
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
>
<
Split
/>
<
CodeEditor
title=
{
<
div
className=
'uppercase'
>
{
t
(
`${i18nPrefix}.code`
)
}
</
div
>
}
headerRight=
{
<
div
className=
'flex items-center'
>
<
a
className=
'flex items-center space-x-0.5 h-[18px] text-xs font-normal text-gray-500'
href=
"https://jinja.palletsprojects.com/en/3.1.x/templates/"
target=
'_blank'
>
<
span
>
{
t
(
`${i18nPrefix}.codeSupportTip`
)
}
</
span
>
<
HelpCircle
className=
'w-3 h-3'
/>
</
a
>
<
div
className=
'mx-1.5 w-px h-3 bg-gray-200'
></
div
>
</
div
>
}
value=
{
inputs
.
template
}
onChange=
{
handleCodeChange
}
/>
</
Field
>
</
div
>
<
Split
/>
<
CodeEditor
title=
{
<
div
className=
'uppercase'
>
{
t
(
`${i18nPrefix}.code`
)
}
</
div
>
}
headerRight=
{
<
div
className=
'flex items-center'
>
<
a
className=
'flex items-center space-x-0.5 h-[18px] text-xs font-normal text-gray-500'
href=
"https://jinja.palletsprojects.com/en/3.1.x/templates/"
target=
'_blank'
>
<
span
>
{
t
(
`${i18nPrefix}.codeSupportTip`
)
}
</
span
>
<
HelpCircle
className=
'w-3 h-3'
/>
</
a
>
<
div
className=
'mx-1.5 w-px h-3 bg-gray-200'
></
div
>
</
div
>
}
value=
{
inputs
.
template
}
onChange=
{
handleCodeChange
}
/>
<
Split
/>
<
OutputVars
>
<>
<
VarItem
name=
'output'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.output`
)
}
/>
</>
</
OutputVars
>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
>
<>
<
VarItem
name=
'output'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.output`
)
}
/>
</>
</
OutputVars
>
</
div
>
</
div
>
)
}
...
...
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