fix: can choose mcp tools

pull/22091/head
Joel 12 months ago
parent 7a76f38d90
commit b3eca1b664

@ -54,6 +54,7 @@ type FormProps<
nodeId?: string nodeId?: string
nodeOutputVars?: NodeOutPutVar[], nodeOutputVars?: NodeOutPutVar[],
availableNodes?: Node[], availableNodes?: Node[],
canChooseMCPTool?: boolean
} }
function Form< function Form<
@ -79,6 +80,7 @@ function Form<
nodeId, nodeId,
nodeOutputVars, nodeOutputVars,
availableNodes, availableNodes,
canChooseMCPTool,
}: FormProps<CustomFormSchema>) { }: FormProps<CustomFormSchema>) {
const language = useLanguage() const language = useLanguage()
const [changeKey, setChangeKey] = useState('') const [changeKey, setChangeKey] = useState('')
@ -377,6 +379,7 @@ function Form<
value={value[variable] || []} value={value[variable] || []}
onChange={item => handleFormChange(variable, item as any)} onChange={item => handleFormChange(variable, item as any)}
supportCollapse supportCollapse
canChooseMCPTool={canChooseMCPTool}
/> />
{fieldMoreInfo?.(formSchema)} {fieldMoreInfo?.(formSchema)}
{validating && changeKey === variable && <ValidatingTip />} {validating && changeKey === variable && <ValidatingTip />}

@ -63,6 +63,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
const { const {
setControlPromptEditorRerenderKey, setControlPromptEditorRerenderKey,
} = workflowStore.getState() } = workflowStore.getState()
const override: ComponentProps<typeof Form<CustomField>>['override'] = [ const override: ComponentProps<typeof Form<CustomField>>['override'] = [
[FormTypeEnum.textNumber, FormTypeEnum.textInput], [FormTypeEnum.textNumber, FormTypeEnum.textInput],
(schema, props) => { (schema, props) => {
@ -220,6 +221,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
nodeId={nodeId} nodeId={nodeId}
nodeOutputVars={nodeOutputVars || []} nodeOutputVars={nodeOutputVars || []}
availableNodes={availableNodes || []} availableNodes={availableNodes || []}
canChooseMCPTool={canChooseMCPTool}
/> />
</div> </div>
: <ListEmpty : <ListEmpty

@ -104,7 +104,7 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
{t('workflow.nodes.agent.toolbox')} {t('workflow.nodes.agent.toolbox')}
</GroupLabel>}> </GroupLabel>}>
<div className='grid grid-cols-10 gap-0.5'> <div className='grid grid-cols-10 gap-0.5'>
{tools.map(tool => <ToolIcon {...tool} key={tool.id} />)} {tools.map((tool, i) => <ToolIcon {...tool} key={tool.id + i} />)}
</div> </div>
</Group>} </Group>}
</div> </div>

@ -114,6 +114,7 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
nodeOutputVars={availableVars} nodeOutputVars={availableVars}
availableNodes={availableNodesWithParent} availableNodes={availableNodesWithParent}
nodeId={props.id} nodeId={props.id}
canChooseMCPTool={canChooseMCPTool}
/> />
</Field> </Field>
<div className='px-4 py-2'> <div className='px-4 py-2'>

Loading…
Cancel
Save