mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 14:06:15 +08:00
fix: external knowledge setting in knowledge selector (#18519)
This commit is contained in:
parent
94e22ba0fd
commit
e0e92921b5
@ -62,13 +62,13 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
|||||||
const { notify } = useToastContext()
|
const { notify } = useToastContext()
|
||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
const isExternal = currentDataset.provider === 'external'
|
const isExternal = currentDataset.provider === 'external'
|
||||||
const [topK, setTopK] = useState(currentDataset?.external_retrieval_model.top_k ?? 2)
|
|
||||||
const [scoreThreshold, setScoreThreshold] = useState(currentDataset?.external_retrieval_model.score_threshold ?? 0.5)
|
|
||||||
const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(currentDataset?.external_retrieval_model.score_threshold_enabled ?? false)
|
|
||||||
const { setShowAccountSettingModal } = useModalContext()
|
const { setShowAccountSettingModal } = useModalContext()
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const { isCurrentWorkspaceDatasetOperator } = useAppContext()
|
const { isCurrentWorkspaceDatasetOperator } = useAppContext()
|
||||||
const [localeCurrentDataset, setLocaleCurrentDataset] = useState({ ...currentDataset })
|
const [localeCurrentDataset, setLocaleCurrentDataset] = useState({ ...currentDataset })
|
||||||
|
const [topK, setTopK] = useState(localeCurrentDataset?.external_retrieval_model.top_k ?? 2)
|
||||||
|
const [scoreThreshold, setScoreThreshold] = useState(localeCurrentDataset?.external_retrieval_model.score_threshold ?? 0.5)
|
||||||
|
const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(localeCurrentDataset?.external_retrieval_model.score_threshold_enabled ?? false)
|
||||||
const [selectedMemberIDs, setSelectedMemberIDs] = useState<string[]>(currentDataset.partial_member_list || [])
|
const [selectedMemberIDs, setSelectedMemberIDs] = useState<string[]>(currentDataset.partial_member_list || [])
|
||||||
const [memberList, setMemberList] = useState<Member[]>([])
|
const [memberList, setMemberList] = useState<Member[]>([])
|
||||||
|
|
||||||
@ -88,6 +88,14 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
|||||||
setScoreThreshold(data.score_threshold)
|
setScoreThreshold(data.score_threshold)
|
||||||
if (data.score_threshold_enabled !== undefined)
|
if (data.score_threshold_enabled !== undefined)
|
||||||
setScoreThresholdEnabled(data.score_threshold_enabled)
|
setScoreThresholdEnabled(data.score_threshold_enabled)
|
||||||
|
|
||||||
|
setLocaleCurrentDataset({
|
||||||
|
...localeCurrentDataset,
|
||||||
|
external_retrieval_model: {
|
||||||
|
...localeCurrentDataset?.external_retrieval_model,
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user