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
04515698
Commit
04515698
authored
Feb 29, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: not show rerank modal picker
parent
257e795c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
28 deletions
+50
-28
config-content.tsx
...iguration/dataset-config/params-config/config-content.tsx
+0
-2
index.tsx
web/app/components/base/param-item/index.tsx
+1
-1
index.tsx
...ount-setting/model-provider-page/model-selector/index.tsx
+1
-1
retrieval-config.tsx
...nodes/knowledge-retrieval/components/retrieval-config.tsx
+30
-11
mock.ts
...app/components/workflow/nodes/knowledge-retrieval/mock.ts
+1
-1
panel.tsx
...p/components/workflow/nodes/knowledge-retrieval/panel.tsx
+11
-10
types.ts
...pp/components/workflow/nodes/knowledge-retrieval/types.ts
+1
-1
workflow.ts
web/i18n/en-US/workflow.ts
+2
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+2
-0
debug.ts
web/models/debug.ts
+1
-1
No files found.
web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
View file @
04515698
...
...
@@ -37,9 +37,7 @@ const ConfigContent: FC<Props> = ({
const
{
modelList
:
rerankModelList
,
defaultModel
:
rerankDefaultModel
,
currentModel
:
isRerankDefaultModelVaild
,
}
=
useModelListAndDefaultModelAndCurrentProviderAndModel
(
3
)
const
rerankModel
=
(()
=>
{
if
(
datasetConfigs
.
reranking_model
)
{
return
{
...
...
web/app/components/base/param-item/index.tsx
View file @
04515698
...
...
@@ -48,7 +48,7 @@ const ParamItem: FC<Props> = ({ className, id, name, noTooltip, tip, step = 0.1,
</
div
>
<
div
className=
"mt-2 flex items-center"
>
<
div
className=
"mr-4 flex shrink-0 items-center"
>
<
input
disabled=
{
!
enable
}
type=
"number"
min=
{
min
}
max=
{
max
}
step=
{
step
}
className=
"block w-[48px] h-7 text-xs leading-[18px] rounded-lg border-0 pl-1 pl py-1.5 bg-gray-50 text-gray-900 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-primary-600 disabled:opacity-60"
value=
{
value
}
onChange=
{
(
e
)
=>
{
<
input
disabled=
{
!
enable
}
type=
"number"
min=
{
min
}
max=
{
max
}
step=
{
step
}
className=
"block w-[48px] h-7 text-xs leading-[18px] rounded-lg border-0 pl-1 pl py-1.5 bg-gray-50 text-gray-900 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-primary-600 disabled:opacity-60"
value=
{
(
value
===
null
||
value
===
undefined
)
?
''
:
value
}
onChange=
{
(
e
)
=>
{
const
value
=
parseFloat
(
e
.
target
.
value
)
if
(
value
<
min
||
value
>
max
)
return
...
...
web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx
View file @
04515698
...
...
@@ -96,7 +96,7 @@ const ModelSelector: FC<ModelSelectorProps> = ({
)
}
</
PortalToFollowElemTrigger
>
<
PortalToFollowElemContent
className=
{
`z-[
60
] ${popupClassName}`
}
>
<
PortalToFollowElemContent
className=
{
`z-[
1002
] ${popupClassName}`
}
>
<
Popup
defaultModel=
{
defaultModel
}
modelList=
{
modelList
}
...
...
web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx
View file @
04515698
...
...
@@ -11,6 +11,8 @@ import {
}
from
'@/app/components/base/portal-to-follow-elem'
import
ConfigRetrievalContent
from
'@/app/components/app/configuration/dataset-config/params-config/config-content'
import
{
RETRIEVE_TYPE
}
from
'@/types/app'
import
{
DATASET_DEFAULT
}
from
'@/config'
import
{
useModelListAndDefaultModelAndCurrentProviderAndModel
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
import
type
{
DatasetConfigs
,
...
...
@@ -35,6 +37,11 @@ const RetrievalConfig: FC<Props> = ({
const
[
open
,
setOpen
]
=
useState
(
false
)
const
{
defaultModel
:
rerankDefaultModel
,
currentModel
:
isRerankDefaultModelVaild
,
}
=
useModelListAndDefaultModelAndCurrentProviderAndModel
(
3
)
const
{
multiple_retrieval_config
}
=
payload
const
handleChange
=
useCallback
((
configs
:
DatasetConfigs
,
isRetrievalModeChange
?:
boolean
)
=>
{
if
(
isRetrievalModeChange
)
{
...
...
@@ -43,11 +50,18 @@ const RetrievalConfig: FC<Props> = ({
}
onMultipleRetrievalConfigChange
({
top_k
:
configs
.
top_k
,
score_threshold
:
configs
.
score_threshold_enabled
?
configs
.
score_threshold
:
null
,
reranking_model
:
{
provider
:
configs
.
reranking_model
?.
reranking_provider_name
,
model
:
configs
.
reranking_model
?.
reranking_model_name
,
},
score_threshold
:
configs
.
score_threshold_enabled
?
(
configs
.
score_threshold
||
DATASET_DEFAULT
.
score_threshold
)
:
null
,
reranking_model
:
payload
.
retrieval_mode
===
RETRIEVE_TYPE
.
oneWay
?
undefined
:
(
!
configs
.
reranking_model
?.
reranking_provider_name
?
{
provider
:
rerankDefaultModel
?.
provider
?.
provider
||
''
,
model
:
rerankDefaultModel
?.
model
||
''
,
}
:
{
provider
:
configs
.
reranking_model
?.
reranking_provider_name
,
model
:
configs
.
reranking_model
?.
reranking_model_name
,
}),
})
},
[
onRetrievalModeChange
,
onMultipleRetrievalConfigChange
])
...
...
@@ -75,13 +89,18 @@ const RetrievalConfig: FC<Props> = ({
datasetConfigs=
{
{
retrieval_model
:
payload
.
retrieval_mode
,
reranking_model
:
{
reranking_provider_name
:
multiple_retrieval_config
?.
reranking_model
?.
provider
||
''
,
reranking_model_name
:
multiple_retrieval_config
?.
reranking_model
?.
model
||
''
,
},
top_k
:
multiple_retrieval_config
?.
top_k
||
5
,
reranking_model
:
!
multiple_retrieval_config
?.
reranking_model
?.
provider
?
{
reranking_provider_name
:
rerankDefaultModel
?.
provider
?.
provider
||
''
,
reranking_model_name
:
rerankDefaultModel
?.
model
||
''
,
}
:
{
reranking_provider_name
:
multiple_retrieval_config
?.
reranking_model
?.
provider
||
''
,
reranking_model_name
:
multiple_retrieval_config
?.
reranking_model
?.
model
||
''
,
},
top_k
:
multiple_retrieval_config
?.
top_k
||
DATASET_DEFAULT
.
top_k
,
score_threshold_enabled
:
!
(
multiple_retrieval_config
?.
score_threshold
===
undefined
||
multiple_retrieval_config
?.
score_threshold
===
null
),
score_threshold
:
multiple_retrieval_config
?.
score_threshold
||
0.5
,
score_threshold
:
multiple_retrieval_config
?.
score_threshold
,
datasets
:
{
datasets
:
[],
},
...
...
web/app/components/workflow/nodes/knowledge-retrieval/mock.ts
View file @
04515698
...
...
@@ -11,7 +11,7 @@ export const mockData: KnowledgeRetrievalNodeType = {
retrieval_mode
:
RETRIEVE_TYPE
.
oneWay
,
multiple_retrieval_config
:
{
top_k
:
10
,
score_threshold
:
0.5
,
score_threshold
:
null
,
reranking_model
:
{
provider
:
''
,
model
:
''
,
...
...
web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx
View file @
04515698
...
...
@@ -67,21 +67,22 @@ const Panel: FC = () => {
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.content`
),
},
// url, title, link like bing search reference result: link, link page title, link page icon
{
name
:
'title'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.title`
),
},
//
{
//
name: 'url',
//
type: 'string',
// description: t(`$
{
i18nPrefix
}.
outputVars
.
url
`)
//
},
//
{
//
name: 'icon',
//
type: 'string',
// description: t(`
$
{
i18nPrefix
}.
outputVars
.
icon
`)
//
},
{
name
:
'url'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.url`
),
},
{
name
:
'icon'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.icon`
),
},
{
name
:
'metadata'
,
type
:
'object'
,
...
...
web/app/components/workflow/nodes/knowledge-retrieval/types.ts
View file @
04515698
...
...
@@ -4,7 +4,7 @@ import type { RETRIEVE_TYPE } from '@/types/app'
export
type
MultipleRetrievalConfig
=
{
top_k
:
number
score_threshold
:
number
|
null
|
undefined
reranking_model
:
{
reranking_model
?
:
{
provider
:
string
model
:
string
}
...
...
web/i18n/en-US/workflow.ts
View file @
04515698
...
...
@@ -61,6 +61,8 @@ const translation = {
output
:
'Retrieval segmented data'
,
content
:
'Segmented content'
,
title
:
'Segmented title'
,
icon
:
'Segmented icon'
,
url
:
'Segmented URL'
,
metadata
:
'Other metadata'
,
},
},
...
...
web/i18n/zh-Hans/workflow.ts
View file @
04515698
...
...
@@ -60,6 +60,8 @@ const translation = {
output
:
'召回的分段'
,
content
:
'分段内容'
,
title
:
'分段标题'
,
icon
:
'分段图标'
,
url
:
'分段链接'
,
metadata
:
'其他元数据'
,
},
},
...
...
web/models/debug.ts
View file @
04515698
...
...
@@ -143,7 +143,7 @@ export type DatasetConfigs = {
}
top_k
:
number
score_threshold_enabled
:
boolean
score_threshold
:
number
score_threshold
?:
number
|
null
datasets
:
{
datasets
:
{
enabled
:
boolean
...
...
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