Merge branch 'feature/tool_yjp' into release/v0.2.7
This commit is contained in:
@@ -36,7 +36,7 @@ export const getToolMethods = (tool_id: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MCP市场列表
|
// MCP市场列表
|
||||||
export const getMarketTools = (data: Query) => {
|
export const getMarketTools = (data?: Record<string, any>) => {
|
||||||
return request.get('/mcp_markets/mcp_markets', data)
|
return request.get('/mcp_markets/mcp_markets', data)
|
||||||
}
|
}
|
||||||
// 市场配置创建
|
// 市场配置创建
|
||||||
|
|||||||
@@ -1818,7 +1818,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
|
|||||||
marketInDatabase: 'In Database',
|
marketInDatabase: 'In Database',
|
||||||
marketAdd: 'Add',
|
marketAdd: 'Add',
|
||||||
marketRefresh: 'Refresh',
|
marketRefresh: 'Refresh',
|
||||||
marketConfig: 'Configure',
|
marketConfigBtn: 'Configure',
|
||||||
marketConfigConnection: 'Configure Connection',
|
marketConfigConnection: 'Configure Connection',
|
||||||
marketNoServices: 'No MCP Services Available',
|
marketNoServices: 'No MCP Services Available',
|
||||||
marketNotConnected: 'Not Connected to This Market',
|
marketNotConnected: 'Not Connected to This Market',
|
||||||
|
|||||||
@@ -1814,7 +1814,7 @@ export const zh = {
|
|||||||
marketInDatabase: '已入库',
|
marketInDatabase: '已入库',
|
||||||
marketAdd: '添加',
|
marketAdd: '添加',
|
||||||
marketRefresh: '刷新',
|
marketRefresh: '刷新',
|
||||||
marketConfig: '配置',
|
marketConfigBtn: '配置',
|
||||||
marketConfigConnection: '配置连接',
|
marketConfigConnection: '配置连接',
|
||||||
marketNoServices: '暂无可用的 MCP 服务',
|
marketNoServices: '暂无可用的 MCP 服务',
|
||||||
marketNotConnected: '尚未连接此市场',
|
marketNotConnected: '尚未连接此市场',
|
||||||
|
|||||||
@@ -279,6 +279,20 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRefreshAfterAdd = async () => {
|
||||||
|
// 添加成功后,刷新当前选中的市场源的 MCP 列表
|
||||||
|
if (!selectedSource) return;
|
||||||
|
|
||||||
|
// 清除缓存并重新加载,这样会重新获取工具列表并更新 inDatabase 标记
|
||||||
|
setMcpCache(prev => {
|
||||||
|
const next = { ...prev };
|
||||||
|
delete next[selectedSource];
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
setCurrentPage(1);
|
||||||
|
await fetchMcpList(selectedSource, 1);
|
||||||
|
};
|
||||||
|
|
||||||
const renderSourceDetail = () => {
|
const renderSourceDetail = () => {
|
||||||
if (!selectedSource) {
|
if (!selectedSource) {
|
||||||
return (
|
return (
|
||||||
@@ -355,7 +369,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Button icon={<SettingOutlined />} onClick={() => handleOpenConfig(selectedSource)}>
|
<Button icon={<SettingOutlined />} onClick={() => handleOpenConfig(selectedSource)}>
|
||||||
{t('tool.marketConfig')}
|
{t('tool.marketConfigBtn')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="primary" icon={<GlobalOutlined />} onClick={() => window.open(source.url, '_blank')}>
|
<Button type="primary" icon={<GlobalOutlined />} onClick={() => window.open(source.url, '_blank')}>
|
||||||
{t('tool.marketVisit')}
|
{t('tool.marketVisit')}
|
||||||
@@ -373,7 +387,13 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
loader={<Skeleton active paragraph={{ rows: 2 }} className="rb:mt-4" />}
|
loader={<Skeleton active paragraph={{ rows: 2 }} className="rb:mt-4" />}
|
||||||
scrollableTarget="mcpScrollableDiv"
|
scrollableTarget="mcpScrollableDiv"
|
||||||
>
|
>
|
||||||
<div className="rb:grid rb:grid-cols-3 rb:gap-4">
|
<div
|
||||||
|
className="rb:gap-4"
|
||||||
|
style={{
|
||||||
|
display: 'grid',
|
||||||
|
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))'
|
||||||
|
}}
|
||||||
|
>
|
||||||
{filteredList.map(mcp => (
|
{filteredList.map(mcp => (
|
||||||
<div
|
<div
|
||||||
key={mcp.id}
|
key={mcp.id}
|
||||||
@@ -425,7 +445,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
{mcp.activated && <Tag color="success">{t('tool.marketActivated')}</Tag>}
|
{mcp.activated && <Tag color="success">{t('tool.marketActivated')}</Tag>}
|
||||||
{mcp.inDatabase && <Tag color="blue">{t('tool.marketInDatabase')}</Tag>}
|
{mcp.inDatabase && <Tag color="blue">{t('tool.marketInDatabase')}</Tag>}
|
||||||
</div>
|
</div>
|
||||||
<Button type="primary" size="small" onClick={() => handleOpenMcpServiceModal(mcp)}>
|
<Button disabled={mcp.inDatabase} type="primary" size="small" onClick={() => handleOpenMcpServiceModal(mcp)}>
|
||||||
+ {t('tool.marketAdd')}
|
+ {t('tool.marketAdd')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -523,7 +543,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
/>
|
/>
|
||||||
<McpServiceModal
|
<McpServiceModal
|
||||||
ref={mcpServiceModalRef}
|
ref={mcpServiceModalRef}
|
||||||
refresh={() => {}}
|
refresh={handleRefreshAfterAdd}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user