mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-08 20:19:03 +08:00
knowledge base node
This commit is contained in:
parent
e1d658b482
commit
6fe473f0fa
@ -16,7 +16,7 @@ import { useNodes } from 'reactflow'
|
||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import produce from 'immer'
|
||||
import { useNodesSyncDraft } from '../../hooks'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks'
|
||||
import type { InputVar, RAGPipelineVariables } from '@/models/pipeline'
|
||||
|
||||
type InputFieldDialogProps = {
|
||||
|
@ -1,13 +1,10 @@
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
} from 'react'
|
||||
import { produce } from 'immer'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { useNodeDataUpdate } from '@/app/components/workflow/hooks'
|
||||
import type { ValueSelector } from '@/app/components/workflow/types'
|
||||
import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import {
|
||||
ChunkStructureEnum,
|
||||
IndexMethodEnum,
|
||||
@ -174,31 +171,6 @@ export const useConfig = (id: string) => {
|
||||
})
|
||||
}, [handleNodeDataUpdate])
|
||||
|
||||
const {
|
||||
currentModel,
|
||||
currentProvider,
|
||||
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.textEmbedding)
|
||||
|
||||
const handleInitConfig = useCallback(() => {
|
||||
const nodeData = getNodeData()
|
||||
|
||||
if (!nodeData?.data.embedding_model && !nodeData?.data.embedding_model_provider && currentModel && currentProvider) {
|
||||
handleEmbeddingModelChange({
|
||||
embeddingModel: currentModel.model,
|
||||
embeddingModelProvider: currentProvider.provider,
|
||||
})
|
||||
}
|
||||
}, [
|
||||
getNodeData,
|
||||
handleEmbeddingModelChange,
|
||||
currentModel,
|
||||
currentProvider,
|
||||
])
|
||||
|
||||
useEffect(() => {
|
||||
handleInitConfig()
|
||||
}, [handleInitConfig])
|
||||
|
||||
return {
|
||||
handleChunkStructureChange,
|
||||
handleIndexMethodChange,
|
||||
|
Loading…
x
Reference in New Issue
Block a user