fix: Fix assemble variables insertion in prompt editor

This commit is contained in:
zhsama
2026-01-19 14:59:08 +08:00
parent 0c62c39a1d
commit 06f6ded20f
6 changed files with 141 additions and 100 deletions

View File

@ -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: '',

View File

@ -256,7 +256,7 @@ type Props = {
showManageInputField?: boolean
onManageInputField?: () => void
showAssembleVariables?: boolean
onAssembleVariables?: () => void
onAssembleVariables?: () => ValueSelector | null
autoFocus?: boolean
preferSchemaType?: boolean
}