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
36664620
Commit
36664620
authored
Feb 18, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: llm input struct
parent
da0d9aab
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
18 deletions
+87
-18
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+1
-0
index.tsx
web/app/components/workflow/index.tsx
+1
-0
field.tsx
web/app/components/workflow/nodes/_base/components/field.tsx
+17
-3
split.tsx
web/app/components/workflow/nodes/_base/components/split.tsx
+18
-0
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+44
-15
workflow.en.ts
web/i18n/lang/workflow.en.ts
+3
-0
workflow.zh.ts
web/i18n/lang/workflow.zh.ts
+3
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
36664620
...
@@ -42,6 +42,7 @@ const Page: FC = () => {
...
@@ -42,6 +42,7 @@ const Page: FC = () => {
<
Workflow
<
Workflow
nodes=
{
initialNodes
}
nodes=
{
initialNodes
}
edges=
{
initialEdges
}
edges=
{
initialEdges
}
selectedNodeId=
'3'
// TODO: for debug. 3: llm.
/>
/>
</
div
>
</
div
>
)
)
...
...
web/app/components/workflow/index.tsx
View file @
36664620
...
@@ -88,6 +88,7 @@ const WorkflowWrapWithReactFlowProvider: FC<WorkflowWrapProps> = ({
...
@@ -88,6 +88,7 @@ const WorkflowWrapWithReactFlowProvider: FC<WorkflowWrapProps> = ({
})
=>
{
})
=>
{
return
(
return
(
<
ReactFlowProvider
>
<
ReactFlowProvider
>
{
selectedNodeId
}
<
WorkflowWrap
<
WorkflowWrap
selectedNodeId=
{
selectedNodeId
}
selectedNodeId=
{
selectedNodeId
}
nodes=
{
nodes
}
nodes=
{
nodes
}
...
...
web/app/components/workflow/nodes/_base/components/field.tsx
View file @
36664620
'use client'
'use client'
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
React
from
'react'
import
cn
from
'classnames'
import
{
HelpCircle
}
from
'@/app/components/base/icons/src/vender/line/general'
import
TooltipPlus
from
'@/app/components/base/tooltip-plus'
type
Props
=
{
type
Props
=
{
title
:
string
title
:
string
tooltip
?:
string
children
:
JSX
.
Element
|
string
children
:
JSX
.
Element
|
string
operations
?:
JSX
.
Element
operations
?:
JSX
.
Element
inline
?:
boolean
}
}
const
Filed
:
FC
<
Props
>
=
({
const
Filed
:
FC
<
Props
>
=
({
title
,
title
,
tooltip
,
children
,
children
,
operations
,
operations
,
inline
,
})
=>
{
})
=>
{
return
(
return
(
<
div
>
<
div
className=
{
cn
(
inline
&&
'flex justify-between items-center'
)
}
>
<
div
className=
'flex justify-between items-center'
>
<
div
className=
'flex justify-between items-center'
>
<
div
className=
'leading-[18px] text-xs font-medium text-gray-500 uppercase'
>
{
title
}
</
div
>
<
div
className=
'flex items-center'
>
<
div
className=
' h-[18px] text-xs font-medium text-gray-500 uppercase'
>
{
title
}
</
div
>
{
tooltip
&&
(
<
TooltipPlus
popupContent=
'tooltip'
>
<
HelpCircle
className=
'w-3.5 h-3.5 ml-0.5 text-gray-400'
/>
</
TooltipPlus
>
)
}
</
div
>
{
operations
&&
<
div
>
{
operations
}
</
div
>
}
{
operations
&&
<
div
>
{
operations
}
</
div
>
}
</
div
>
</
div
>
<
div
>
{
children
}
</
div
>
<
div
>
{
children
}
</
div
>
...
...
web/app/components/workflow/nodes/_base/components/split.tsx
0 → 100644
View file @
36664620
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
cn
from
'classnames'
type
Props
=
{
className
?:
string
}
const
Split
:
FC
<
Props
>
=
({
className
,
})
=>
{
return
(
<
div
className=
{
cn
(
className
,
'h-px bg-black/5'
)
}
>
</
div
>
)
}
export
default
React
.
memo
(
Split
)
web/app/components/workflow/nodes/llm/panel.tsx
View file @
36664620
...
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
...
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
import
BasePanel
from
'../_base/panel'
import
BasePanel
from
'../_base/panel'
import
Field
from
'@/app/components/workflow/nodes/_base/components/field'
import
Field
from
'@/app/components/workflow/nodes/_base/components/field'
import
AddButton
from
'@/app/components/base/button/add-button'
import
AddButton
from
'@/app/components/base/button/add-button'
import
Split
from
'@/app/components/workflow/nodes/_base/components/split'
const
i18nPrefix
=
'workflow.nodes.llm'
const
i18nPrefix
=
'workflow.nodes.llm'
const
Panel
:
FC
=
()
=>
{
const
Panel
:
FC
=
()
=>
{
...
@@ -12,21 +13,49 @@ const Panel: FC = () => {
...
@@ -12,21 +13,49 @@ const Panel: FC = () => {
}
}
return
(
return
(
<
BasePanel
<
BasePanel
inputsElement=
{
<
div
>
inputsElement=
{
<
Field
<
div
className=
'mt-2 px-4 space-y-4'
>
title=
{
t
(
`${i18nPrefix}.model`
)
}
<
Field
>
title=
{
t
(
`${i18nPrefix}.model`
)
}
Model Selector
>
</
Field
>
Model Selector
<
Field
</
Field
>
title=
{
t
(
`${i18nPrefix}.variables`
)
}
operations=
{
<
Field
<
AddButton
onClick=
{
handleAddVariable
}
/>
title=
{
t
(
`${i18nPrefix}.variables`
)
}
}
operations=
{
>
<
AddButton
onClick=
{
handleAddVariable
}
/>
Var Selector
}
</
Field
>
>
</
div
>
}
Var Selector
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.context`
)
}
>
Context
</
Field
>
<
Field
title=
{
t
(
`${i18nPrefix}.context`
)
}
>
Prompt
</
Field
>
<
Split
/>
<
Field
title=
{
t
(
`${i18nPrefix}.vision`
)
}
inline
>
Vision
</
Field
>
{
/* This version not support function */
}
{
/* <Field
title={t(`${i18nPrefix}.fu`)}
inline
>
Functions
</Field> */
}
</
div
>
}
outputsElement=
{
<
div
>
start panel outputs
</
div
>
}
outputsElement=
{
<
div
>
start panel outputs
</
div
>
}
/>
/>
)
)
...
...
web/i18n/lang/workflow.en.ts
View file @
36664620
...
@@ -3,6 +3,9 @@ const translation = {
...
@@ -3,6 +3,9 @@ const translation = {
llm
:
{
llm
:
{
model
:
'model'
,
model
:
'model'
,
variables
:
'variables'
,
variables
:
'variables'
,
context
:
'context'
,
prompt
:
'prompt'
,
vision
:
'vision'
,
},
},
},
},
}
}
...
...
web/i18n/lang/workflow.zh.ts
View file @
36664620
...
@@ -3,6 +3,9 @@ const translation = {
...
@@ -3,6 +3,9 @@ const translation = {
llm
:
{
llm
:
{
model
:
'模型'
,
model
:
'模型'
,
variables
:
'变量'
,
variables
:
'变量'
,
context
:
'上下文'
,
prompt
:
'提示词'
,
vision
:
'视觉'
,
},
},
},
},
}
}
...
...
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