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
b2de27b7
Commit
b2de27b7
authored
Feb 29, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: knowledge query var
parent
9c0d44fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
4 deletions
+61
-4
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+2
-2
mock.ts
...app/components/workflow/nodes/knowledge-retrieval/mock.ts
+2
-1
panel.tsx
...p/components/workflow/nodes/knowledge-retrieval/panel.tsx
+29
-1
use-config.ts
...mponents/workflow/nodes/knowledge-retrieval/use-config.ts
+22
-0
workflow.ts
web/i18n/en-US/workflow.ts
+3
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+3
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
b2de27b7
...
...
@@ -6,9 +6,9 @@ import Workflow from '@/app/components/workflow'
import
{
BlockEnum
}
from
'@/app/components/workflow/types'
const
nodes
=
[
BlockEnum
.
LLM
/* 3 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
KnowledgeRetrieval
/* 4
*/
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
LLM
/* 3
*/
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
IfElse
/* 6 */
,
BlockEnum
.
Code
/* 7 */
,
BlockEnum
.
TemplateTransform
/* 8 */
,
BlockEnum
.
HttpRequest
/* 9 */
,
BlockEnum
.
Tool
/* 10 */
,
BlockEnum
.
End
/* 12 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
End
/* 12 */
,
].
map
((
item
,
i
)
=>
({
id
:
`
${
i
+
1
}
`
,
type
:
'custom'
,
...
...
web/app/components/workflow/nodes/knowledge-retrieval/mock.ts
View file @
b2de27b7
import
{
BlockEnum
}
from
'../../types'
import
type
{
KnowledgeRetrievalNodeType
}
from
'./types'
import
{
RETRIEVE_TYPE
}
from
'@/types/app'
export
const
mockData
:
KnowledgeRetrievalNodeType
=
{
type
:
'KnowledgeRetrieval'
,
type
:
BlockEnum
.
KnowledgeRetrieval
,
desc
:
'xxx'
,
title
:
'KnowledgeRetrieval'
,
query_variable_selector
:
[
'aaa'
,
'name'
],
...
...
web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx
View file @
b2de27b7
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
VarReferencePicker
from
'../_base/components/variable/var-reference-picker'
import
useConfig
from
'./use-config'
import
{
mockData
}
from
'./mock'
import
Field
from
'@/app/components/workflow/nodes/_base/components/field'
const
i18nPrefix
=
'workflow.nodes.knowledgeRetrieval'
const
Panel
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
readOnly
=
false
const
{
inputs
,
handleQueryVarChange
,
}
=
useConfig
(
mockData
)
return
(
<
div
>
start panel inputs
</
div
>
<
div
className=
'mt-2'
>
<
div
className=
'px-4 pb-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.queryVariable`
)
}
>
<
VarReferencePicker
readonly=
{
readOnly
}
isShowNodeName
value=
{
inputs
.
query_variable_selector
}
onChange=
{
handleQueryVarChange
}
/>
</
Field
>
</
div
>
</
div
>
)
}
...
...
web/app/components/workflow/nodes/knowledge-retrieval/use-config.ts
0 → 100644
View file @
b2de27b7
import
{
useCallback
,
useState
}
from
'react'
import
produce
from
'immer'
import
type
{
ValueSelector
}
from
'../../types'
import
type
{
KnowledgeRetrievalNodeType
}
from
'./types'
const
useConfig
=
(
initInputs
:
KnowledgeRetrievalNodeType
)
=>
{
const
[
inputs
,
setInputs
]
=
useState
<
KnowledgeRetrievalNodeType
>
(
initInputs
)
const
handleQueryVarChange
=
useCallback
((
newVar
:
ValueSelector
)
=>
{
const
newInputs
=
produce
(
inputs
,
(
draft
)
=>
{
draft
.
query_variable_selector
=
newVar
})
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
return
{
inputs
,
handleQueryVarChange
,
}
}
export
default
useConfig
web/i18n/en-US/workflow.ts
View file @
b2de27b7
...
...
@@ -54,6 +54,9 @@ const translation = {
usage
:
'Model Usage Information'
,
},
},
knowledgeRetrieval
:
{
queryVariable
:
'Query Variable'
,
},
http
:
{
inputVars
:
'Input Variables'
,
api
:
'API'
,
...
...
web/i18n/zh-Hans/workflow.ts
View file @
b2de27b7
...
...
@@ -53,6 +53,9 @@ const translation = {
usage
:
'模型用量信息'
,
},
},
knowledgeRetrieval
:
{
queryVariable
:
'查询变量'
,
},
http
:
{
inputVars
:
'输入变量'
,
api
:
'API'
,
...
...
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