diff --git a/web/src/hooks/use-mcp-request.ts b/web/src/hooks/use-mcp-request.ts index 6cb2979e9..4bf905728 100644 --- a/web/src/hooks/use-mcp-request.ts +++ b/web/src/hooks/use-mcp-request.ts @@ -106,8 +106,8 @@ export const useDeleteMcpServer = () => { mutateAsync, } = useMutation({ mutationKey: [McpApiAction.DeleteMcpServer], - mutationFn: async (params: Record) => { - const { data = {} } = await mcpServerService.delete(params); + mutationFn: async (ids: string[]) => { + const { data = {} } = await mcpServerService.delete({ mcp_ids: ids }); if (data.code === 0) { message.success(i18n.t(`message.deleted`)); diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx index 74c2fb86d..ec074c2a2 100644 --- a/web/src/pages/agent/constant.tsx +++ b/web/src/pages/agent/constant.tsx @@ -685,6 +685,7 @@ export const initialWaitingDialogueValues = {}; export const initialAgentValues = { ...initialLlmBaseValues, description: '', + user_prompt: '', sys_prompt: ``, prompts: [{ role: PromptRole.User, content: `{${AgentGlobals.SysQuery}}` }], message_history_window_size: 12, diff --git a/web/src/pages/agent/form/agent-form/index.tsx b/web/src/pages/agent/form/agent-form/index.tsx index b3d3b7edc..8aeab368c 100644 --- a/web/src/pages/agent/form/agent-form/index.tsx +++ b/web/src/pages/agent/form/agent-form/index.tsx @@ -12,6 +12,7 @@ import { } from '@/components/ui/form'; import { Input, NumberInput } from '@/components/ui/input'; import { RAGFlowSelect } from '@/components/ui/select'; +import { Textarea } from '@/components/ui/textarea'; import { buildOptions } from '@/utils/form'; import { zodResolver } from '@hookform/resolvers/zod'; import { useMemo } from 'react'; @@ -39,6 +40,7 @@ const exceptionMethodOptions = buildOptions(AgentExceptionMethod); const FormSchema = z.object({ sys_prompt: z.string(), description: z.string().optional(), + user_prompt: z.string().optional(), prompts: z.string().optional(), // prompts: z // .array( @@ -98,7 +100,23 @@ const AgentForm = ({ node }: INextOperatorForm) => { }} > - {isSubAgent && } + {isSubAgent && ( + <> + + ( + + Subagent Input + + + + + )} + /> + + )} { const llmId = useFetchModelId(); @@ -114,8 +120,17 @@ export const useInitializeOperatorParams = () => { }, [llmId]); const initializeOperatorParams = useCallback( - (operatorName: Operator) => { - return initialFormValuesMap[operatorName]; + (operatorName: Operator, position: Position) => { + const initialValues = initialFormValuesMap[operatorName]; + if (isBottomSubAgent(operatorName, position)) { + return { + ...initialValues, + description: 'This is an agent for a specific task.', + user_prompt: 'This is the order you need to send to the agent.', + }; + } + + return initialValues; }, [initialFormValuesMap], ); @@ -235,13 +250,6 @@ function useAddToolNode() { return { addToolNode }; } -function isBottomSubAgent(type: string, position: Position) { - return ( - (type === Operator.Agent && position === Position.Bottom) || - type === Operator.Tool - ); -} - function useResizeIterationNode() { const { getNode, nodes, updateNode } = useGraphStore((state) => state); @@ -324,7 +332,7 @@ export function useAddNode(reactFlowInstance?: ReactFlowInstance) { getNodeName(type), nodes, ), - form: initializeOperatorParams(type as Operator), + form: initializeOperatorParams(type as Operator, params.position), }, sourcePosition: Position.Right, targetPosition: Position.Left, diff --git a/web/src/pages/profile-setting/mcp/mcp-card.tsx b/web/src/pages/profile-setting/mcp/mcp-card.tsx index 1c154d865..bf6023c97 100644 --- a/web/src/pages/profile-setting/mcp/mcp-card.tsx +++ b/web/src/pages/profile-setting/mcp/mcp-card.tsx @@ -35,7 +35,7 @@ export function McpCard({

{data.name}

- + = useCallback((e) => { e.stopPropagation(); }, []); - const handleDelete: MouseEventHandler = - useCallback(() => {}, []); + const handleDelete: MouseEventHandler = useCallback(() => { + deleteMcpServer([mcpId]); + }, [deleteMcpServer, mcpId]); return ( {children} - {t('common.rename')} + {t('common.edit')} diff --git a/web/src/pages/profile-setting/mcp/use-bulk-operate-mcp.tsx b/web/src/pages/profile-setting/mcp/use-bulk-operate-mcp.tsx index 79820079d..e5c1c1473 100644 --- a/web/src/pages/profile-setting/mcp/use-bulk-operate-mcp.tsx +++ b/web/src/pages/profile-setting/mcp/use-bulk-operate-mcp.tsx @@ -1,3 +1,4 @@ +import { useDeleteMcpServer } from '@/hooks/use-mcp-request'; import { Trash2, Upload } from 'lucide-react'; import { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -5,10 +6,13 @@ import { useTranslation } from 'react-i18next'; export function useBulkOperateMCP() { const { t } = useTranslation(); const [selectedList, setSelectedList] = useState>([]); + const { deleteMcpServer } = useDeleteMcpServer(); const handleEnableClick = useCallback(() => {}, []); - const handleDelete = useCallback(() => {}, []); + const handleDelete = useCallback(() => { + deleteMcpServer(selectedList); + }, [deleteMcpServer, selectedList]); const handleSelectChange = useCallback((id: string, checked: boolean) => { setSelectedList((list) => {