mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
fix: Apply MCP node acquisition tool (#3510)
This commit is contained in:
parent
f04de2328a
commit
fce2f50a01
|
|
@ -572,8 +572,8 @@ class PlayDemoTextRequest(serializers.Serializer):
|
|||
|
||||
|
||||
async def get_mcp_tools(servers):
|
||||
async with MultiServerMCPClient(servers) as client:
|
||||
return client.get_tools()
|
||||
client = MultiServerMCPClient(servers)
|
||||
return await client.get_tools()
|
||||
|
||||
|
||||
class McpServersSerializer(serializers.Serializer):
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ class ApplicationAPI(APIView):
|
|||
RoleConstants.USER.get_workspace_role(),
|
||||
RoleConstants.WORKSPACE_MANAGE.get_workspace_role())
|
||||
def get(self, request: Request, workspace_id: str):
|
||||
return result.success(Query(data={'workspace_id': workspace_id, 'user_id': request.user.id}).list(request.query_params))
|
||||
return result.success(
|
||||
Query(data={'workspace_id': workspace_id, 'user_id': request.user.id}).list(request.query_params))
|
||||
|
||||
class Page(APIView):
|
||||
authentication_classes = [TokenAuth]
|
||||
|
|
@ -266,9 +267,11 @@ class McpServers(APIView):
|
|||
[PermissionConstants.APPLICATION.get_workspace_application_permission()],
|
||||
CompareConstants.AND),
|
||||
RoleConstants.WORKSPACE_MANAGE.get_workspace_role())
|
||||
def get(self, request: Request, workspace_id, application_id: str):
|
||||
def post(self, request: Request, workspace_id, application_id: str):
|
||||
return result.success(ApplicationOperateSerializer(
|
||||
data={'mcp_servers': request.query_params.get('mcp_servers')}).get_mcp_servers())
|
||||
data={'mcp_servers': request.query_params.get('mcp_servers'), 'workspace_id': workspace_id,
|
||||
'user_id': request.user.id,
|
||||
'application_id': application_id}).get_mcp_servers(request.data))
|
||||
|
||||
|
||||
class SpeechToText(APIView):
|
||||
|
|
|
|||
|
|
@ -289,11 +289,12 @@ const speechToText: (
|
|||
/**
|
||||
* mcp 节点
|
||||
*/
|
||||
const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix.value}/${application_id}/mcp_tools`, undefined, loading)
|
||||
const getMcpTools: (
|
||||
application_id: String,
|
||||
mcp_servers: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, mcp_servers, loading) => {
|
||||
return post(`${prefix.value}/${application_id}/mcp_tools`, { mcp_servers }, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ function getTools() {
|
|||
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
|
||||
return
|
||||
}
|
||||
applicationApi.getMcpTools(id, loading).then((res: any) => {
|
||||
applicationApi.getMcpTools(id, form_data.value.mcp_servers, loading).then((res: any) => {
|
||||
form_data.value.mcp_tools = res.data
|
||||
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
|
||||
// 修改了json,刷新mcp_server
|
||||
|
|
|
|||
Loading…
Reference in New Issue