mirror of
https://github.com/langgenius/dify.git
synced 2026-01-19 11:45:05 +08:00
fix: summary index change in create document
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { DefaultModel } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import type { SummaryIndexSetting as SummaryIndexSettingType } from '@/models/datasets'
|
||||
import type { RetrievalConfig } from '@/types/app'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { checkShowMultiModalTip } from '@/app/components/datasets/settings/utils'
|
||||
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import { useDefaultModel, useModelList, useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
@ -122,6 +122,12 @@ export const useIndexingConfig = (options: UseIndexingConfigOptions) => {
|
||||
const [summaryIndexSetting, setSummaryIndexSetting] = useState<SummaryIndexSettingType | undefined>(
|
||||
initialSummaryIndexSetting ?? undefined,
|
||||
)
|
||||
const summaryIndexSettingRef = useRef<SummaryIndexSettingType | undefined>(initialSummaryIndexSetting ?? undefined)
|
||||
|
||||
const handleSummaryIndexSettingChange = useCallback((payload: SummaryIndexSettingType) => {
|
||||
setSummaryIndexSetting({ ...summaryIndexSettingRef.current, ...payload })
|
||||
summaryIndexSettingRef.current = { ...summaryIndexSettingRef.current, ...payload }
|
||||
}, [])
|
||||
|
||||
return {
|
||||
// Index type
|
||||
@ -148,7 +154,7 @@ export const useIndexingConfig = (options: UseIndexingConfigOptions) => {
|
||||
|
||||
// Summary index setting
|
||||
summaryIndexSetting,
|
||||
setSummaryIndexSetting,
|
||||
handleSummaryIndexSettingChange,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ const StepTwo: FC<StepTwoProps> = ({
|
||||
onReset={segmentation.resetToDefaults}
|
||||
locale={locale}
|
||||
summaryIndexSetting={indexing.summaryIndexSetting}
|
||||
onSummaryIndexSettingChange={indexing.setSummaryIndexSetting}
|
||||
onSummaryIndexSettingChange={indexing.handleSummaryIndexSettingChange}
|
||||
/>
|
||||
)}
|
||||
{showParentChildOption && (
|
||||
@ -240,7 +240,7 @@ const StepTwo: FC<StepTwoProps> = ({
|
||||
onPreview={updatePreview}
|
||||
onReset={segmentation.resetToDefaults}
|
||||
summaryIndexSetting={indexing.summaryIndexSetting}
|
||||
onSummaryIndexSettingChange={indexing.setSummaryIndexSetting}
|
||||
onSummaryIndexSettingChange={indexing.handleSummaryIndexSettingChange}
|
||||
/>
|
||||
)}
|
||||
<Divider className="my-5" />
|
||||
|
||||
Reference in New Issue
Block a user