2025-05-09 16:35:09 +08:00
|
|
|
import type { RAGPipelineVariables } from '@/models/pipeline'
|
2025-04-18 15:46:54 +08:00
|
|
|
import type { StateCreator } from 'zustand'
|
2025-05-09 16:35:09 +08:00
|
|
|
import { InputVarType } from '../../workflow/types'
|
2025-04-18 15:46:54 +08:00
|
|
|
|
|
|
|
export type RagPipelineSliceShape = {
|
2025-05-07 16:30:24 +08:00
|
|
|
pipelineId: string
|
2025-04-22 11:29:03 +08:00
|
|
|
showInputFieldDialog: boolean
|
|
|
|
setShowInputFieldDialog: (showInputFieldPanel: boolean) => void
|
2025-04-21 17:49:26 +08:00
|
|
|
nodesDefaultConfigs: Record<string, any>
|
|
|
|
setNodesDefaultConfigs: (nodesDefaultConfigs: Record<string, any>) => void
|
2025-05-09 16:35:09 +08:00
|
|
|
ragPipelineVariables: RAGPipelineVariables
|
|
|
|
setRagPipelineVariables: (ragPipelineVariables: RAGPipelineVariables) => void
|
2025-04-18 15:46:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export type CreateRagPipelineSliceSlice = StateCreator<RagPipelineSliceShape>
|
|
|
|
export const createRagPipelineSliceSlice: StateCreator<RagPipelineSliceShape> = set => ({
|
2025-05-07 16:30:24 +08:00
|
|
|
pipelineId: '',
|
2025-04-22 11:29:03 +08:00
|
|
|
showInputFieldDialog: false,
|
|
|
|
setShowInputFieldDialog: showInputFieldDialog => set(() => ({ showInputFieldDialog })),
|
2025-04-21 17:49:26 +08:00
|
|
|
nodesDefaultConfigs: {},
|
|
|
|
setNodesDefaultConfigs: nodesDefaultConfigs => set(() => ({ nodesDefaultConfigs })),
|
2025-05-09 16:35:09 +08:00
|
|
|
ragPipelineVariables: [{
|
|
|
|
// TODO: delete mock data
|
|
|
|
nodeId: '123',
|
|
|
|
variables: [{
|
|
|
|
variable: 'name',
|
|
|
|
label: 'name',
|
|
|
|
type: InputVarType.textInput,
|
|
|
|
required: true,
|
|
|
|
max_length: 12,
|
|
|
|
}, {
|
|
|
|
variable: 'num',
|
|
|
|
label: 'num',
|
|
|
|
type: InputVarType.number,
|
|
|
|
required: true,
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
nodeId: '',
|
|
|
|
variables: [{
|
|
|
|
variable: 'name',
|
|
|
|
label: 'name',
|
|
|
|
type: InputVarType.textInput,
|
|
|
|
required: true,
|
|
|
|
max_length: 12,
|
|
|
|
}, {
|
|
|
|
variable: 'num',
|
|
|
|
label: 'num',
|
|
|
|
type: InputVarType.number,
|
|
|
|
required: true,
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
setRagPipelineVariables: (ragPipelineVariables: RAGPipelineVariables) => set(() => ({ ragPipelineVariables })),
|
2025-04-18 15:46:54 +08:00
|
|
|
})
|