Merge branch 'feature/tool_yjp' into release/v0.2.7

This commit is contained in:
yujiangping
2026-03-11 17:13:50 +08:00
4 changed files with 27 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ export const getToolMethods = (tool_id: string) => {
}
// MCP市场列表
export const getMarketTools = (data: Query) => {
export const getMarketTools = (data?: Record<string, any>) => {
return request.get('/mcp_markets/mcp_markets', data)
}
// 市场配置创建

View File

@@ -1818,7 +1818,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
marketInDatabase: 'In Database',
marketAdd: 'Add',
marketRefresh: 'Refresh',
marketConfig: 'Configure',
marketConfigBtn: 'Configure',
marketConfigConnection: 'Configure Connection',
marketNoServices: 'No MCP Services Available',
marketNotConnected: 'Not Connected to This Market',

View File

@@ -1814,7 +1814,7 @@ export const zh = {
marketInDatabase: '已入库',
marketAdd: '添加',
marketRefresh: '刷新',
marketConfig: '配置',
marketConfigBtn: '配置',
marketConfigConnection: '配置连接',
marketNoServices: '暂无可用的 MCP 服务',
marketNotConnected: '尚未连接此市场',

View File

@@ -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 = () => {
if (!selectedSource) {
return (
@@ -355,7 +369,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
)}
</div>
<Button icon={<SettingOutlined />} onClick={() => handleOpenConfig(selectedSource)}>
{t('tool.marketConfig')}
{t('tool.marketConfigBtn')}
</Button>
<Button type="primary" icon={<GlobalOutlined />} onClick={() => window.open(source.url, '_blank')}>
{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" />}
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 => (
<div
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.inDatabase && <Tag color="blue">{t('tool.marketInDatabase')}</Tag>}
</div>
<Button type="primary" size="small" onClick={() => handleOpenMcpServiceModal(mcp)}>
<Button disabled={mcp.inDatabase} type="primary" size="small" onClick={() => handleOpenMcpServiceModal(mcp)}>
+ {t('tool.marketAdd')}
</Button>
</div>
@@ -523,7 +543,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
/>
<McpServiceModal
ref={mcpServiceModalRef}
refresh={() => {}}
refresh={handleRefreshAfterAdd}
/>
</div>
);