support mcp client streamable http (#4650)
* support mcp streamable http * fix * fix * remove deps
This commit is contained in:
@@ -15,7 +15,7 @@ import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import { postRunMCPTools } from '@/web/core/app/api/plugin';
|
||||
import { postRunMCPTool } from '@/web/core/app/api/plugin';
|
||||
|
||||
const JsonEditor = dynamic(() => import('@fastgpt/web/components/common/Textarea/JsonEditor'));
|
||||
|
||||
@@ -39,7 +39,7 @@ const ChatTest = ({ currentTool, url }: { currentTool: ToolType | null; url: str
|
||||
const { runAsync: runTool, loading: isRunning } = useRequest2(
|
||||
async (data: Record<string, any>) => {
|
||||
if (!currentTool) return;
|
||||
return await postRunMCPTools({
|
||||
return await postRunMCPTool({
|
||||
params: data,
|
||||
url,
|
||||
toolName: currentTool.name
|
||||
|
||||
@@ -4,7 +4,6 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getMCPTools } from '@/web/core/app/api/plugin';
|
||||
import { AppContext } from '../context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import MyIconButton from '@fastgpt/web/components/common/Icon/button';
|
||||
@@ -12,7 +11,8 @@ import { ToolType } from '@fastgpt/global/core/app/type';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { getMCPToolsBody } from '@/pages/api/core/app/mcpTools/getMCPTools';
|
||||
import type { getMCPToolsBody } from '@/pages/api/support/mcp/client/getTools';
|
||||
import { getMCPTools } from '@/web/core/app/api/plugin';
|
||||
|
||||
const EditForm = ({
|
||||
url,
|
||||
|
||||
@@ -26,7 +26,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { AppListContext } from './context';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { ToolType } from '@fastgpt/global/core/app/type';
|
||||
import { getMCPToolsBody } from '@/pages/api/core/app/mcpTools/getMCPTools';
|
||||
import type { getMCPToolsBody } from '@/pages/api/support/mcp/client/getTools';
|
||||
|
||||
export type MCPToolSetData = {
|
||||
url: string;
|
||||
@@ -81,7 +81,7 @@ const MCPToolsEditModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const { runAsync: runGetMCPTools, loading: isGettingTools } = useRequest2(
|
||||
(data: getMCPToolsBody) => getMCPTools(data),
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
onSuccess: (res: ToolType[]) => {
|
||||
setValue('mcpData.toolList', res);
|
||||
},
|
||||
errorToast: t('app:MCP_tools_parse_failed')
|
||||
|
||||
Reference in New Issue
Block a user