update:智控台增加mcp接入点的配置

This commit is contained in:
hrz
2025-06-26 16:54:26 +08:00
parent 6812c5ac40
commit 1d293244d3
5 changed files with 17 additions and 5 deletions
@@ -232,7 +232,7 @@ public interface Constant {
/**
* 版本号
*/
public static final String VERSION = "0.5.8";
public static final String VERSION = "0.6.1";
/**
* 无效固件URL
@@ -0,0 +1,2 @@
delete from `sys_params` where id = 113;
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (113, 'server.mcp_endpoint', 'null', 'string', 1, 'mcp接入点地址');
@@ -218,4 +218,11 @@ databaseChangeLog:
changes:
- sqlFile:
encoding: utf8
path: classpath:db/changelog/202506191643.sql
path: classpath:db/changelog/202506191643.sql
- changeSet:
id: 202506261637
author: hrz
changes:
- sqlFile:
encoding: utf8
path: classpath:db/changelog/202506261637.sql
@@ -15,8 +15,7 @@ logger = setup_logging()
async def connect_mcp_endpoint(mcp_endpoint_url: str) -> MCPEndpointClient:
"""连接到MCP接入点"""
if not mcp_endpoint_url:
logger.bind(tag=TAG).warning("MCP接入点URL为空,跳过连接")
if not mcp_endpoint_url or "你的" in mcp_endpoint_url or mcp_endpoint_url == "null":
return None
try:
@@ -82,7 +82,11 @@ class UnifiedToolHandler:
# 从配置中获取MCP接入点URL
mcp_endpoint_url = self.config.get("mcp_endpoint", "")
if mcp_endpoint_url and "你的" not in mcp_endpoint_url:
if (
mcp_endpoint_url
and "你的" not in mcp_endpoint_url
and mcp_endpoint_url != "null"
):
self.logger.info(f"正在初始化MCP接入点: {mcp_endpoint_url}")
mcp_endpoint_client = await connect_mcp_endpoint(mcp_endpoint_url)