fix: open input field modal from var picker

This commit is contained in:
zxhlyh 2025-08-01 11:28:30 +08:00
parent f75a3ef212
commit d8ac78056e
6 changed files with 33 additions and 0 deletions

View File

@ -31,6 +31,8 @@ type Props = {
inPanel?: boolean inPanel?: boolean
currentTool?: Tool currentTool?: Tool
currentProvider?: ToolWithProvider currentProvider?: ToolWithProvider
showManageInputField?: boolean
onManageInputField?: () => void
} }
const FormInputItem: FC<Props> = ({ const FormInputItem: FC<Props> = ({
@ -42,6 +44,8 @@ const FormInputItem: FC<Props> = ({
inPanel, inPanel,
currentTool, currentTool,
currentProvider, currentProvider,
showManageInputField,
onManageInputField,
}) => { }) => {
const language = useLanguage() const language = useLanguage()
@ -192,6 +196,8 @@ const FormInputItem: FC<Props> = ({
onChange={handleValueChange} onChange={handleValueChange}
nodesOutputVars={availableVars} nodesOutputVars={availableVars}
availableNodes={availableNodesWithParent} availableNodes={availableNodesWithParent}
showManageInputField={showManageInputField}
onManageInputField={onManageInputField}
/> />
)} )}
{isNumber && isConstant && ( {isNumber && isConstant && (

View File

@ -146,6 +146,8 @@ const Editor: FC<Props> = ({
} }
const getVarType = useWorkflowVariableType() const getVarType = useWorkflowVariableType()
const pipelineId = useStore(s => s.pipelineId)
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
return ( return (
<Wrap className={cn(className, wrapClassName)} style={wrapStyle} isInNode isExpand={isExpand}> <Wrap className={cn(className, wrapClassName)} style={wrapStyle} isInNode isExpand={isExpand}>
@ -270,6 +272,8 @@ const Editor: FC<Props> = ({
} }
return acc return acc
}, {} as any), }, {} as any),
showManageInputField: !!pipelineId,
onManageInputField: () => setShowInputFieldDialog?.(true),
}} }}
onChange={onChange} onChange={onChange}
onBlur={setBlur} onBlur={setBlur}

View File

@ -17,6 +17,8 @@ type MixedVariableTextInputProps = {
availableNodes?: Node[] availableNodes?: Node[]
value?: string value?: string
onChange?: (text: string) => void onChange?: (text: string) => void
showManageInputField?: boolean
onManageInputField?: () => void
} }
const MixedVariableTextInput = ({ const MixedVariableTextInput = ({
readOnly = false, readOnly = false,
@ -24,6 +26,8 @@ const MixedVariableTextInput = ({
availableNodes = [], availableNodes = [],
value = '', value = '',
onChange, onChange,
showManageInputField,
onManageInputField,
}: MixedVariableTextInputProps) => { }: MixedVariableTextInputProps) => {
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
@ -52,6 +56,8 @@ const MixedVariableTextInput = ({
} }
return acc return acc
}, {} as any), }, {} as any),
showManageInputField,
onManageInputField,
}} }}
placeholder={<Placeholder />} placeholder={<Placeholder />}
onChange={onChange} onChange={onChange}

View File

@ -16,6 +16,8 @@ type Props = {
inPanel?: boolean inPanel?: boolean
currentTool?: Tool currentTool?: Tool
currentProvider?: ToolWithProvider currentProvider?: ToolWithProvider
showManageInputField?: boolean
onManageInputField?: () => void
} }
const ToolForm: FC<Props> = ({ const ToolForm: FC<Props> = ({
@ -27,6 +29,8 @@ const ToolForm: FC<Props> = ({
inPanel, inPanel,
currentTool, currentTool,
currentProvider, currentProvider,
showManageInputField,
onManageInputField,
}) => { }) => {
return ( return (
<div className='space-y-1'> <div className='space-y-1'>
@ -42,6 +46,8 @@ const ToolForm: FC<Props> = ({
inPanel={inPanel} inPanel={inPanel}
currentTool={currentTool} currentTool={currentTool}
currentProvider={currentProvider} currentProvider={currentProvider}
showManageInputField={showManageInputField}
onManageInputField={onManageInputField}
/> />
)) ))
} }

View File

@ -24,6 +24,8 @@ type Props = {
inPanel?: boolean inPanel?: boolean
currentTool?: Tool currentTool?: Tool
currentProvider?: ToolWithProvider currentProvider?: ToolWithProvider
showManageInputField?: boolean
onManageInputField?: () => void
} }
const ToolFormItem: FC<Props> = ({ const ToolFormItem: FC<Props> = ({
@ -35,6 +37,8 @@ const ToolFormItem: FC<Props> = ({
inPanel, inPanel,
currentTool, currentTool,
currentProvider, currentProvider,
showManageInputField,
onManageInputField,
}) => { }) => {
const language = useLanguage() const language = useLanguage()
const { name, label, type, required, tooltip, input_schema } = schema const { name, label, type, required, tooltip, input_schema } = schema
@ -89,6 +93,8 @@ const ToolFormItem: FC<Props> = ({
inPanel={inPanel} inPanel={inPanel}
currentTool={currentTool} currentTool={currentTool}
currentProvider={currentProvider} currentProvider={currentProvider}
showManageInputField={showManageInputField}
onManageInputField={onManageInputField}
/> />
{isShowSchema && ( {isShowSchema && (

View File

@ -11,6 +11,7 @@ import Loading from '@/app/components/base/loading'
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
import StructureOutputItem from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show' import StructureOutputItem from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show'
import { Type } from '../llm/types' import { Type } from '../llm/types'
import { useStore } from '@/app/components/workflow/store'
const i18nPrefix = 'workflow.nodes.tool' const i18nPrefix = 'workflow.nodes.tool'
@ -37,6 +38,8 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
} = useConfig(id, data) } = useConfig(id, data)
const [collapsed, setCollapsed] = React.useState(false) const [collapsed, setCollapsed] = React.useState(false)
const pipelineId = useStore(s => s.pipelineId)
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
if (isLoading) { if (isLoading) {
return <div className='flex h-[200px] items-center justify-center'> return <div className='flex h-[200px] items-center justify-center'>
@ -61,6 +64,8 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
onChange={setInputVar} onChange={setInputVar}
currentProvider={currCollection} currentProvider={currCollection}
currentTool={currTool} currentTool={currTool}
showManageInputField={!!pipelineId}
onManageInputField={() => setShowInputFieldDialog?.(true)}
/> />
</Field> </Field>
)} )}