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
5a27a95f
Commit
5a27a95f
authored
Mar 06, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: llm support type select
parent
5ec3a967
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+1
-1
config-prompt.tsx
...omponents/workflow/nodes/llm/components/config-prompt.tsx
+30
-1
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
5a27a95f
...
...
@@ -32,7 +32,7 @@ const allMockData = {
[
BlockEnum
.
End
]:
EndNodeMock
,
}
const
nodes
=
[
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
LLM
/* 3
*/
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
LLM
/* 3 */
,
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2
*/
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
IfElse
/* 6 */
,
BlockEnum
.
Code
/* 7 */
,
BlockEnum
.
TemplateTransform
/* 8 */
,
BlockEnum
.
HttpRequest
/* 9 */
,
BlockEnum
.
Tool
/* 10 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
End
/* 12 */
,
].
map
((
item
,
i
)
=>
{
...
...
web/app/components/workflow/nodes/llm/components/config-prompt.tsx
View file @
5a27a95f
...
...
@@ -7,6 +7,7 @@ import type { PromptItem } from '../../../types'
import
{
PromptRole
}
from
'../../../types'
import
Editor
from
'@/app/components/workflow/nodes/_base/components/prompt/editor'
import
AddButton
from
'@/app/components/workflow/nodes/_base/components/add-button'
import
TypeSelector
from
'@/app/components/workflow/nodes/_base/components/selector'
const
i18nPrefix
=
'workflow.nodes.llm'
...
...
@@ -36,6 +37,26 @@ const ConfigPrompt: FC<Props> = ({
}
},
[
onChange
,
payload
])
const
roleOptions
=
[
{
label
:
'user'
,
value
:
PromptRole
.
user
,
},
{
label
:
'system'
,
value
:
PromptRole
.
system
,
},
]
const
handleChatModeMessageRoleChange
=
useCallback
((
index
:
number
)
=>
{
return
(
role
:
PromptRole
)
=>
{
const
newPrompt
=
produce
(
payload
as
PromptItem
[],
(
draft
)
=>
{
draft
[
index
].
role
=
role
})
onChange
(
newPrompt
)
}
},
[
onChange
,
payload
])
const
handleAddPrompt
=
useCallback
(()
=>
{
const
newPrompt
=
produce
(
payload
as
PromptItem
[],
(
draft
)
=>
{
const
isLastItemUser
=
draft
[
draft
.
length
-
1
].
role
===
PromptRole
.
user
...
...
@@ -71,7 +92,15 @@ const ConfigPrompt: FC<Props> = ({
return
(
<
Editor
key=
{
index
}
title=
{
item
.
role
===
PromptRole
.
user
?
'User'
:
'System'
}
title=
{
<
div
className=
'relative left-1'
>
<
TypeSelector
value=
{
item
.
role
as
string
}
options=
{
roleOptions
}
onChange=
{
handleChatModeMessageRoleChange
(
index
)
}
/>
</
div
>
}
value=
{
item
.
text
}
onChange=
{
handleChatModePromptChange
(
index
)
}
variables=
{
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