mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
fix: Fix assemble variables insertion in prompt editor
This commit is contained in:
@ -235,7 +235,15 @@ const FormInputItem: FC<Props> = ({
|
||||
|
||||
const handleValueChange = (newValue: any, newType?: VarKindType, mentionConfig?: MentionConfig | null) => {
|
||||
const normalizedValue = isNumber ? Number.parseFloat(newValue) : newValue
|
||||
const resolvedType = newType ?? (varInput?.type === VarKindType.mention ? VarKindType.mention : getVarKindType())
|
||||
const assemblePlaceholder = nodeId && variable
|
||||
? `{{#${nodeId}_ext_${variable}.result#}}`
|
||||
: ''
|
||||
const isAssembleValue = typeof normalizedValue === 'string'
|
||||
&& assemblePlaceholder
|
||||
&& normalizedValue.includes(assemblePlaceholder)
|
||||
const resolvedType = isAssembleValue
|
||||
? VarKindType.mixed
|
||||
: newType ?? (varInput?.type === VarKindType.mention ? VarKindType.mention : getVarKindType())
|
||||
const resolvedMentionConfig = resolvedType === VarKindType.mention
|
||||
? (mentionConfig ?? varInput?.mention_config ?? {
|
||||
extractor_node_id: '',
|
||||
|
||||
@ -256,7 +256,7 @@ type Props = {
|
||||
showManageInputField?: boolean
|
||||
onManageInputField?: () => void
|
||||
showAssembleVariables?: boolean
|
||||
onAssembleVariables?: () => void
|
||||
onAssembleVariables?: () => ValueSelector | null
|
||||
autoFocus?: boolean
|
||||
preferSchemaType?: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user