Feature/MCP (Model Context Protocol) (#4134)

add mcp tools
This commit is contained in:
Henry Heng
2025-03-06 13:57:18 +00:00
committed by GitHub
parent 9c22bee991
commit 713ed26971
21 changed files with 1321 additions and 105 deletions
@@ -2,7 +2,7 @@ import { createPortal } from 'react-dom'
import { useState, useEffect } from 'react'
import { useSelector } from 'react-redux'
import PropTypes from 'prop-types'
import { Dialog, DialogContent, DialogTitle } from '@mui/material'
import { Box, Dialog, DialogContent, DialogTitle, Typography } from '@mui/material'
import ReactJson from 'flowise-react-json-view'
const SourceDocDialog = ({ show, dialogProps, onCancel }) => {
@@ -32,6 +32,25 @@ const SourceDocDialog = ({ show, dialogProps, onCancel }) => {
{dialogProps.title ?? 'Source Documents'}
</DialogTitle>
<DialogContent>
{data.error && (
<Box
sx={{
p: 2,
borderRadius: 1,
bgcolor: 'error.light',
color: 'error.dark',
overflowX: 'auto',
wordBreak: 'break-word'
}}
>
<Typography variant='body2' fontWeight='medium'>
Error:
</Typography>
<Typography variant='body2' sx={{ whiteSpace: 'pre-wrap' }}>
{data.error}
</Typography>
</Box>
)}
<ReactJson
theme={customization.isDarkMode ? 'ocean' : 'rjv-default'}
style={{ padding: 10, borderRadius: 10 }}
@@ -1214,10 +1214,30 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
key={index}
label={tool.tool}
component='a'
sx={{ mr: 1, mt: 1 }}
sx={{
mr: 1,
mt: 1,
borderColor: tool.error
? 'error.main'
: undefined,
color: tool.error
? 'error.main'
: undefined
}}
variant='outlined'
clickable
icon={<IconTool size={15} />}
icon={
<IconTool
size={15}
color={
tool.error
? theme.palette
.error
.main
: undefined
}
/>
}
onClick={() =>
onSourceDialogClick(
tool,
@@ -1407,9 +1427,24 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
key={index}
label={tool.tool}
component='a'
sx={{ mr: 1, mt: 1 }}
sx={{
mr: 1,
mt: 1,
borderColor: tool.error ? 'error.main' : undefined,
color: tool.error ? 'error.main' : undefined
}}
variant='outlined'
clickable
icon={
<IconTool
size={15}
color={
tool.error
? theme.palette.error.main
: undefined
}
/>
}
onClick={() => onSourceDialogClick(tool, 'Used Tools')}
/>
)