mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
perf: mcp save raw schema (#5030)
* perf: mcp save raw schema * fix: test * code * perf: json schema test * perf: mcp
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
"@fastgpt/templates": "workspace:*",
|
||||
"@fastgpt/web": "workspace:*",
|
||||
"@fortaine/fetch-event-source": "^3.0.6",
|
||||
"@modelcontextprotocol/sdk": "^1.10.2",
|
||||
"@modelcontextprotocol/sdk": "^1.12.1",
|
||||
"@node-rs/jieba": "2.0.1",
|
||||
"@tanstack/react-query": "^4.24.10",
|
||||
"ahooks": "^3.7.11",
|
||||
|
@@ -137,7 +137,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
<Td>{item.name}</Td>
|
||||
<Td>
|
||||
<HStack>
|
||||
<MyIcon name={provider?.avatar as any} w={'1rem'} />
|
||||
<MyIcon
|
||||
name={(providerData?.avatar || provider?.avatar) as any}
|
||||
w={'1rem'}
|
||||
/>
|
||||
<Box>{t(providerData?.label as any)}</Box>
|
||||
</HStack>
|
||||
</Td>
|
||||
|
@@ -2,13 +2,11 @@ import { type FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { type NodeProps } from 'reactflow';
|
||||
import NodeCard from '../render/NodeCard';
|
||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowContext } from '../../../context';
|
||||
import {
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
toolValueTypeList,
|
||||
WorkflowIOValueTypeEnum
|
||||
} from '@fastgpt/global/core/workflow/constants';
|
||||
import { Box, Flex, Table, TableContainer, Tbody, Td, Th, Thead, Tr } from '@chakra-ui/react';
|
||||
|
@@ -12,8 +12,7 @@ const NodeToolSet = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { inputs } = data;
|
||||
const toolList: McpToolConfigType[] = inputs.find((item) => item.key === 'toolSetData')?.value
|
||||
?.toolList;
|
||||
const toolList: McpToolConfigType[] = inputs[0]?.value?.toolList;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'350px'} selected={selected} {...data}>
|
||||
|
@@ -15,7 +15,6 @@ import { pushTrack } from '@fastgpt/service/common/middle/tracks/utils';
|
||||
import { checkTeamAppLimit } from '@fastgpt/service/support/permission/teamLimit';
|
||||
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { type StoreSecretValueType } from '@fastgpt/global/common/secret/type';
|
||||
import { encryptSecret } from '@fastgpt/service/common/secret/aes256gcm';
|
||||
import { storeSecretValue } from '@fastgpt/service/common/secret/utils';
|
||||
|
||||
export type createMCPToolsQuery = {};
|
||||
|
@@ -6,7 +6,7 @@ import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { type Tool } from '@modelcontextprotocol/sdk/types';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { toolValueTypeList } from '@fastgpt/global/core/workflow/constants';
|
||||
import { toolValueTypeList, valueTypeJsonSchemaMap } from '@fastgpt/global/core/workflow/constants';
|
||||
import { type AppChatConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import { type FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io';
|
||||
@@ -51,9 +51,9 @@ export const pluginNodes2InputSchema = (
|
||||
};
|
||||
|
||||
pluginInput?.inputs.forEach((input) => {
|
||||
const jsonSchema = (
|
||||
toolValueTypeList.find((type) => type.value === input.valueType) || toolValueTypeList[0]
|
||||
)?.jsonSchema;
|
||||
const jsonSchema = input.valueType
|
||||
? valueTypeJsonSchemaMap[input.valueType] || toolValueTypeList[0].jsonSchema
|
||||
: toolValueTypeList[0].jsonSchema;
|
||||
|
||||
schema.properties![input.key] = {
|
||||
...jsonSchema,
|
||||
@@ -96,9 +96,9 @@ export const workflow2InputSchema = (chatConfig?: {
|
||||
};
|
||||
|
||||
chatConfig?.variables?.forEach((item) => {
|
||||
const jsonSchema = (
|
||||
toolValueTypeList.find((type) => type.value === item.valueType) || toolValueTypeList[0]
|
||||
)?.jsonSchema;
|
||||
const jsonSchema = item.valueType
|
||||
? valueTypeJsonSchemaMap[item.valueType] || toolValueTypeList[0].jsonSchema
|
||||
: toolValueTypeList[0].jsonSchema;
|
||||
|
||||
schema.properties![item.key] = {
|
||||
...jsonSchema,
|
||||
|
@@ -110,6 +110,15 @@ export const getChannelList = () =>
|
||||
GET<ChannelListResponseType>('/channels/all', {
|
||||
page: 1,
|
||||
perPage: 10
|
||||
}).then((res) => {
|
||||
res.sort((a, b) => {
|
||||
if (a.status !== b.status) {
|
||||
return a.status - b.status;
|
||||
}
|
||||
return b.priority - a.priority;
|
||||
});
|
||||
console.log(res);
|
||||
return res;
|
||||
});
|
||||
|
||||
export const getChannelProviders = () =>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
"mcp_test": "npx @modelcontextprotocol/inspector"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.10.2",
|
||||
"@modelcontextprotocol/sdk": "^1.12.1",
|
||||
"axios": "^1.8.2",
|
||||
"chalk": "^5.3.0",
|
||||
"dayjs": "^1.11.7",
|
||||
|
Reference in New Issue
Block a user