mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-18 18:25:54 +08:00
chore: change field to backend
This commit is contained in:
parent
96d2582d89
commit
5ec604500c
@ -6,7 +6,7 @@ const i18nPrefix = 'workflow.errorMsg'
|
|||||||
|
|
||||||
const nodeDefault: NodeDefault<DocExtractorNodeType> = {
|
const nodeDefault: NodeDefault<DocExtractorNodeType> = {
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
variable: [],
|
variable_selector: [],
|
||||||
},
|
},
|
||||||
getAvailablePrevNodes(isChatMode: boolean) {
|
getAvailablePrevNodes(isChatMode: boolean) {
|
||||||
const nodes = isChatMode
|
const nodes = isChatMode
|
||||||
@ -20,7 +20,7 @@ const nodeDefault: NodeDefault<DocExtractorNodeType> = {
|
|||||||
},
|
},
|
||||||
checkValid(payload: DocExtractorNodeType, t: any) {
|
checkValid(payload: DocExtractorNodeType, t: any) {
|
||||||
let errorMessages = ''
|
let errorMessages = ''
|
||||||
const { variable } = payload
|
const { variable_selector: variable } = payload
|
||||||
|
|
||||||
if (!errorMessages && !variable?.length)
|
if (!errorMessages && !variable?.length)
|
||||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.assigner.assignedVariable') })
|
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.assigner.assignedVariable') })
|
||||||
|
@ -15,7 +15,7 @@ const NodeComponent: FC<NodeProps<DocExtractorNodeType>> = ({
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const nodes: Node[] = useNodes()
|
const nodes: Node[] = useNodes()
|
||||||
const { variable } = data
|
const { variable_selector: variable } = data
|
||||||
|
|
||||||
if (!variable || variable.length === 0)
|
if (!variable || variable.length === 0)
|
||||||
return null
|
return null
|
||||||
|
@ -33,7 +33,7 @@ const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({
|
|||||||
readonly={readOnly}
|
readonly={readOnly}
|
||||||
nodeId={id}
|
nodeId={id}
|
||||||
isShowNodeName
|
isShowNodeName
|
||||||
value={inputs.variable || []}
|
value={inputs.variable_selector || []}
|
||||||
onChange={handleVarChanges}
|
onChange={handleVarChanges}
|
||||||
filterVar={filterVar}
|
filterVar={filterVar}
|
||||||
/>
|
/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
||||||
|
|
||||||
export type DocExtractorNodeType = CommonNodeType & {
|
export type DocExtractorNodeType = CommonNodeType & {
|
||||||
variable: ValueSelector
|
variable_selector: ValueSelector
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const useConfig = (id: string, payload: DocExtractorNodeType) => {
|
|||||||
|
|
||||||
const handleVarChanges = useCallback((variable: ValueSelector | string) => {
|
const handleVarChanges = useCallback((variable: ValueSelector | string) => {
|
||||||
const newInputs = produce(inputs, (draft) => {
|
const newInputs = produce(inputs, (draft) => {
|
||||||
draft.variable = variable as ValueSelector
|
draft.variable_selector = variable as ValueSelector
|
||||||
})
|
})
|
||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
}, [inputs, setInputs])
|
}, [inputs, setInputs])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user