|
|
|
@ -38,7 +38,7 @@ import ConfigContext from '@/context/debug-configuration'
|
|
|
|
import Config from '@/app/components/app/configuration/config'
|
|
|
|
import Config from '@/app/components/app/configuration/config'
|
|
|
|
import Debug from '@/app/components/app/configuration/debug'
|
|
|
|
import Debug from '@/app/components/app/configuration/debug'
|
|
|
|
import Confirm from '@/app/components/base/confirm'
|
|
|
|
import Confirm from '@/app/components/base/confirm'
|
|
|
|
import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
|
|
|
import { ModelFeatureEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
|
|
|
import { ToastContext } from '@/app/components/base/toast'
|
|
|
|
import { ToastContext } from '@/app/components/base/toast'
|
|
|
|
import { fetchAppDetail, updateAppModelConfig } from '@/service/apps'
|
|
|
|
import { fetchAppDetail, updateAppModelConfig } from '@/service/apps'
|
|
|
|
import { promptVariablesToUserInputsForm, userInputsFormToPromptVariables } from '@/utils/model-config'
|
|
|
|
import { promptVariablesToUserInputsForm, userInputsFormToPromptVariables } from '@/utils/model-config'
|
|
|
|
@ -53,7 +53,10 @@ import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
|
|
|
import Drawer from '@/app/components/base/drawer'
|
|
|
|
import Drawer from '@/app/components/base/drawer'
|
|
|
|
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
|
|
|
|
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
|
|
|
|
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
|
|
|
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
|
|
|
import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
|
|
|
import {
|
|
|
|
|
|
|
|
useModelListAndDefaultModelAndCurrentProviderAndModel,
|
|
|
|
|
|
|
|
useTextGenerationCurrentProviderAndModelAndModelList,
|
|
|
|
|
|
|
|
} from '@/app/components/header/account-setting/model-provider-page/hooks'
|
|
|
|
import { fetchCollectionList } from '@/service/tools'
|
|
|
|
import { fetchCollectionList } from '@/service/tools'
|
|
|
|
import { type Collection } from '@/app/components/tools/types'
|
|
|
|
import { type Collection } from '@/app/components/tools/types'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
@ -217,6 +220,9 @@ const Configuration: FC = () => {
|
|
|
|
const [isShowSelectDataSet, { setTrue: showSelectDataSet, setFalse: hideSelectDataSet }] = useBoolean(false)
|
|
|
|
const [isShowSelectDataSet, { setTrue: showSelectDataSet, setFalse: hideSelectDataSet }] = useBoolean(false)
|
|
|
|
const selectedIds = dataSets.map(item => item.id)
|
|
|
|
const selectedIds = dataSets.map(item => item.id)
|
|
|
|
const [rerankSettingModalOpen, setRerankSettingModalOpen] = useState(false)
|
|
|
|
const [rerankSettingModalOpen, setRerankSettingModalOpen] = useState(false)
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
|
|
|
currentModel: currentRerankModel,
|
|
|
|
|
|
|
|
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.rerank)
|
|
|
|
const handleSelect = (data: DataSet[]) => {
|
|
|
|
const handleSelect = (data: DataSet[]) => {
|
|
|
|
if (isEqual(data.map(item => item.id), dataSets.map(item => item.id))) {
|
|
|
|
if (isEqual(data.map(item => item.id), dataSets.map(item => item.id))) {
|
|
|
|
hideSelectDataSet()
|
|
|
|
hideSelectDataSet()
|
|
|
|
@ -263,7 +269,7 @@ const Configuration: FC = () => {
|
|
|
|
reranking_mode: restConfigs.reranking_mode,
|
|
|
|
reranking_mode: restConfigs.reranking_mode,
|
|
|
|
weights: restConfigs.weights,
|
|
|
|
weights: restConfigs.weights,
|
|
|
|
reranking_enable: restConfigs.reranking_enable,
|
|
|
|
reranking_enable: restConfigs.reranking_enable,
|
|
|
|
}, newDatasets)
|
|
|
|
}, newDatasets, dataSets, !!currentRerankModel)
|
|
|
|
|
|
|
|
|
|
|
|
setDatasetConfigs({
|
|
|
|
setDatasetConfigs({
|
|
|
|
...retrievalConfig,
|
|
|
|
...retrievalConfig,
|
|
|
|
@ -603,9 +609,11 @@ const Configuration: FC = () => {
|
|
|
|
|
|
|
|
|
|
|
|
syncToPublishedConfig(config)
|
|
|
|
syncToPublishedConfig(config)
|
|
|
|
setPublishedConfig(config)
|
|
|
|
setPublishedConfig(config)
|
|
|
|
|
|
|
|
const retrievalConfig = getMultipleRetrievalConfig(modelConfig.dataset_configs, datasets, datasets, !!currentRerankModel)
|
|
|
|
setDatasetConfigs({
|
|
|
|
setDatasetConfigs({
|
|
|
|
retrieval_model: RETRIEVE_TYPE.multiWay,
|
|
|
|
retrieval_model: RETRIEVE_TYPE.multiWay,
|
|
|
|
...modelConfig.dataset_configs,
|
|
|
|
...modelConfig.dataset_configs,
|
|
|
|
|
|
|
|
...retrievalConfig,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
setHasFetchedDetail(true)
|
|
|
|
setHasFetchedDetail(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|