mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 17:38:04 +08:00
pipeline header
This commit is contained in:
@ -1,12 +1,18 @@
|
||||
import { memo } from 'react'
|
||||
import VarReferencePicker from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
|
||||
import { Field } from '@/app/components/workflow/nodes/_base/components/layout'
|
||||
import type { ValueSelector } from '@/app/components/workflow/types'
|
||||
|
||||
const InputVariable = () => {
|
||||
const handleChange = () => {
|
||||
console.log('')
|
||||
}
|
||||
|
||||
type InputVariableProps = {
|
||||
nodeId: string
|
||||
inputVariable?: string[]
|
||||
onInputVariableChange: (inputVariable: string | ValueSelector) => void
|
||||
}
|
||||
const InputVariable = ({
|
||||
nodeId,
|
||||
inputVariable = [],
|
||||
onInputVariableChange,
|
||||
}: InputVariableProps) => {
|
||||
return (
|
||||
<Field
|
||||
fieldTitleProps={{
|
||||
@ -15,10 +21,10 @@ const InputVariable = () => {
|
||||
}}
|
||||
>
|
||||
<VarReferencePicker
|
||||
nodeId={''}
|
||||
nodeId={nodeId}
|
||||
isShowNodeName
|
||||
value={[]}
|
||||
onChange={handleChange}
|
||||
value={inputVariable}
|
||||
onChange={onInputVariableChange}
|
||||
readonly={false}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
@ -3,6 +3,7 @@ import {
|
||||
} from 'react'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { useNodeDataUpdate } from '@/app/components/workflow/hooks'
|
||||
import type { ValueSelector } from '@/app/components/workflow/types'
|
||||
import type {
|
||||
ChunkStructureEnum,
|
||||
HybridSearchModeEnum,
|
||||
@ -147,6 +148,12 @@ export const useConfig = (id: string) => {
|
||||
})
|
||||
}, [getNodeData, handleNodeDataUpdate])
|
||||
|
||||
const handleInputVariableChange = useCallback((inputVariable: string | ValueSelector) => {
|
||||
handleNodeDataUpdate({
|
||||
index_chunk_variable_selector: Array.isArray(inputVariable) ? inputVariable : [],
|
||||
})
|
||||
}, [handleNodeDataUpdate])
|
||||
|
||||
return {
|
||||
handleChunkStructureChange,
|
||||
handleIndexMethodChange,
|
||||
@ -159,5 +166,6 @@ export const useConfig = (id: string) => {
|
||||
handleTopKChange,
|
||||
handleScoreThresholdChange,
|
||||
handleScoreThresholdEnabledChange,
|
||||
handleInputVariableChange,
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,12 +35,17 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
handleTopKChange,
|
||||
handleScoreThresholdChange,
|
||||
handleScoreThresholdEnabledChange,
|
||||
handleInputVariableChange,
|
||||
} = useConfig(id)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<GroupWithBox boxProps={{ withBorderBottom: true }}>
|
||||
<InputVariable />
|
||||
<InputVariable
|
||||
nodeId={id}
|
||||
inputVariable={data.index_chunk_variable_selector}
|
||||
onInputVariableChange={handleInputVariableChange}
|
||||
/>
|
||||
</GroupWithBox>
|
||||
<Group
|
||||
className='py-3'
|
||||
|
||||
Reference in New Issue
Block a user