Skip to content

Commit

Permalink
Merge branch 'fix/rerank-validation-issue' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh committed Oct 31, 2024
2 parents 4c73bef + 95e0db9 commit 8c191d1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
17 changes: 17 additions & 0 deletions web/app/components/app/configuration/dataset-config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AppType } from '@/types/app'
import type { DataSet } from '@/models/datasets'
import {
getMultipleRetrievalConfig,
getSelectedDatasetsMode,
} from '@/app/components/workflow/nodes/knowledge-retrieval/utils'
import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
Expand All @@ -38,6 +39,7 @@ const DatasetConfig: FC = () => {
isAgent,
datasetConfigs,
setDatasetConfigs,
setRerankSettingModalOpen,
} = useContext(ConfigContext)
const formattingChangedDispatcher = useFormattingChangedDispatcher()

Expand All @@ -55,6 +57,21 @@ const DatasetConfig: FC = () => {
...(datasetConfigs as any),
...retrievalConfig,
})
const {
allExternal,
allEconomic,
allInternal,
mixtureInternalAndExternal,
mixtureHighQualityAndEconomic,
inconsistentEmbeddingModel,
} = getSelectedDatasetsMode(filteredDataSets)

if (
(allInternal && (allEconomic || mixtureHighQualityAndEconomic || inconsistentEmbeddingModel))
|| mixtureInternalAndExternal
|| allExternal
)
setRerankSettingModalOpen(true)
formattingChangedDispatcher()
}

Expand Down
9 changes: 8 additions & 1 deletion web/app/components/app/configuration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,19 @@ const Configuration: FC = () => {
}
hideSelectDataSet()
const {
allExternal,
allEconomic,
allInternal,
mixtureInternalAndExternal,
mixtureHighQualityAndEconomic,
inconsistentEmbeddingModel,
} = getSelectedDatasetsMode(newDatasets)

if (allEconomic || mixtureHighQualityAndEconomic || inconsistentEmbeddingModel)
if (
(allInternal && (allEconomic || mixtureHighQualityAndEconomic || inconsistentEmbeddingModel))
|| mixtureInternalAndExternal
|| allExternal
)
setRerankSettingModalOpen(true)

const { datasets, retrieval_model, score_threshold_enabled, ...restConfigs } = datasetConfigs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {
if (
(allInternal && (mixtureHighQualityAndEconomic || inconsistentEmbeddingModel))
|| mixtureInternalAndExternal
|| (allExternal && newDatasets.length > 1)
|| allExternal
)
setRerankModelOpen(true)
}, [inputs, setInputs, payload.retrieval_mode, selectedDatasets, currentRerankModel])
Expand Down

0 comments on commit 8c191d1

Please sign in to comment.