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
0518da1e
Commit
0518da1e
authored
Mar 01, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: handle llm memory
parent
6f6f0322
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
732 additions
and
531 deletions
+732
-531
mock.ts
web/app/components/workflow/nodes/llm/mock.ts
+6
-3
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+9
-3
yarn.lock
web/yarn.lock
+717
-525
No files found.
web/app/components/workflow/nodes/llm/mock.ts
View file @
0518da1e
import
{
MemoryRole
}
from
'../../types'
import
{
BlockEnum
}
from
'../../types'
import
type
{
LLMNodeType
}
from
'./types'
import
{
Resolution
}
from
'@/types/app'
export
const
mockData
:
LLMNodeType
=
{
title
:
'Test'
,
desc
:
'Test'
,
type
:
'Test'
,
type
:
BlockEnum
.
LLM
,
model
:
{
provider
:
'openai'
,
name
:
'gpt-4'
,
...
...
@@ -26,7 +26,10 @@ export const mockData: LLMNodeType = {
],
prompt
:
[],
memory
:
{
role_prefix
:
MemoryRole
.
assistant
,
role_prefix
:
{
user
:
'user: '
,
assistant
:
'assistant: '
,
},
window
:
{
enabled
:
false
,
size
:
0
,
...
...
web/app/components/workflow/nodes/llm/panel.tsx
View file @
0518da1e
...
...
@@ -26,9 +26,11 @@ const Panel: FC = () => {
handleContextVarChange
,
handleMemoryChange
,
}
=
useConfig
(
mockData
)
const
isChatApp
=
true
// TODO: get from app context
const
model
=
inputs
.
model
const
modelMode
=
inputs
.
model
?.
mode
const
isChatMode
=
modelMode
===
'chat'
const
isChatModel
=
modelMode
===
'chat'
const
isCompletionModel
=
!
isChatModel
return
(
<
div
className=
'mt-2'
>
...
...
@@ -84,14 +86,18 @@ const Panel: FC = () => {
Prompt
</
Field
>
{
/* */
}
{
isChatApp
&&
isChatApp
&&
(
<
div
className=
'text-xs text-gray-300'
>
Memory examples(Designing)
</
div
>
)
}
{
/* Memory */
}
{
isChat
Mode
&&
(
{
isChat
App
&&
(
<>
<
MemoryConfig
readonly=
{
readOnly
}
payload=
{
inputs
.
memory
}
onChange=
{
handleMemoryChange
}
canSetRoleName
canSetRoleName
=
{
isCompletionModel
}
/>
<
Split
/>
</>
...
...
web/yarn.lock
View file @
0518da1e
This diff is collapsed.
Click to expand it.
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