Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: multiple retrieval default weighted score (#6897)

zxhlyh33dab4fe5480
diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsx
index b52e3a60b2c..98676f2e838 100644
--- a/web/app/components/datasets/common/retrieval-param-config/index.tsx
+++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx
@@ -16,6 +16,7 @@ import ModelSelector from '@/app/components/header/account-setting/model-provide
import { useModelListAndDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import {
+ DEFAULT_WEIGHTED_SCORE,
RerankingModeEnum,
WeightedScoreEnum,
} from '@/models/datasets'
@@ -69,12 +70,12 @@ const RetrievalParamConfig: FC<Props> = ({
result.weights = {
weight_type: WeightedScoreEnum.Customized,
vector_setting: {
- vector_weight: 0.5,
+ vector_weight: DEFAULT_WEIGHTED_SCORE.other.semantic,
embedding_provider_name: '',
embedding_model_name: '',
},
keyword_setting: {
- keyword_weight: 0.5,
+ keyword_weight: DEFAULT_WEIGHTED_SCORE.other.keyword,
},
}
}
@@ -202,7 +203,6 @@ const RetrievalParamConfig: FC<Props> = ({
value.reranking_mode === RerankingModeEnum.WeightedScore && (
<WeightedScore
value={{
- type: value.weights!.weight_type,
value: [
value.weights!.vector_setting.vector_weight,
value.weights!.keyword_setting.keyword_weight,
@@ -213,7 +213,6 @@ const RetrievalParamConfig: FC<Props> = ({
...value,
weights: {
...value.weights!,
- weight_type: v.type,
vector_setting: {
...value.weights!.vector_setting,
vector_weight: v.value[0],
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts b/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts
index 3835e88f904..89ae9b47640 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts
@@ -88,7 +88,7 @@ export const getMultipleRetrievalConfig = (multipleRetrievalConfig: MultipleRetr
reranking_mode,
reranking_model,
weights,
- reranking_enable,
+ reranking_enable: allEconomic ? reranking_enable : true,
}
if (allEconomic || mixtureHighQualityAndEconomic || inconsistentEmbeddingModel)