From 08c781fdc265fd883f536a19aefbdf138ee5468f Mon Sep 17 00:00:00 2001 From: zhsama Date: Fri, 16 Jan 2026 16:02:15 +0800 Subject: [PATCH] Align panel warning with mention config --- .../nodes/_base/components/form-input-item.tsx | 2 ++ .../mixed-variable-text-input/index.tsx | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/form-input-item.tsx b/web/app/components/workflow/nodes/_base/components/form-input-item.tsx index 661c69c4dc..00c484f9af 100644 --- a/web/app/components/workflow/nodes/_base/components/form-input-item.tsx +++ b/web/app/components/workflow/nodes/_base/components/form-input-item.tsx @@ -351,6 +351,8 @@ const FormInputItem: FC = ({ disableVariableInsertion={disableVariableInsertion} toolNodeId={nodeId} paramKey={variable} + varType={varInput?.type} + mentionConfig={varInput?.mention_config} /> )} {isNumber && isConstant && ( diff --git a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx index 1e3848bf48..cd541cf3b0 100644 --- a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx +++ b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx @@ -125,6 +125,8 @@ type MixedVariableTextInputProps = { disableVariableInsertion?: boolean toolNodeId?: string paramKey?: string + varType?: VarKindType + mentionConfig?: MentionConfig | null } const MixedVariableTextInput = ({ @@ -138,6 +140,8 @@ const MixedVariableTextInput = ({ disableVariableInsertion = false, toolNodeId, paramKey = '', + varType, + mentionConfig, }: MixedVariableTextInputProps) => { const { t } = useTranslation() const language = useGetLanguage() @@ -224,16 +228,23 @@ const MixedVariableTextInput = ({ return Boolean(errorMessage) }, [language, nodesMetaDataMap, strategyProviders, t]) + const extractorNodeId = useMemo(() => { + if (mentionConfig?.extractor_node_id) + return mentionConfig.extractor_node_id + if (varType === VarKindTypeEnum.mention && toolNodeId && paramKey) + return `${toolNodeId}_ext_${paramKey}` + return '' + }, [mentionConfig?.extractor_node_id, paramKey, toolNodeId, varType]) + const hasAgentWarning = useMemo(() => { if (!detectedAgentFromValue) return false const agentWarning = getNodeWarning(nodesById[detectedAgentFromValue.nodeId]) - if (!toolNodeId || !paramKey) + if (!extractorNodeId) return agentWarning - const extractorNodeId = `${toolNodeId}_ext_${paramKey}` const extractorWarning = getNodeWarning(nodesById[extractorNodeId]) return agentWarning || extractorWarning - }, [detectedAgentFromValue, getNodeWarning, nodesById, paramKey, toolNodeId]) + }, [detectedAgentFromValue, extractorNodeId, getNodeWarning, nodesById]) const syncExtractorPromptFromText = useCallback((text: string) => { if (!toolNodeId || !paramKey)