对接小智MCP协议控制

This commit is contained in:
myifeng
2025-05-29 13:42:31 +08:00
parent 8ea48f9875
commit 4b212753fb
4 changed files with 262 additions and 98 deletions
@@ -1,7 +1,7 @@
import json
from core.handle.abortHandle import handleAbortMessage
from core.handle.helloHandle import handleHelloMessage
from core.handle.mcpHandle import handleMCPMessage
from core.handle.mcpHandle import handle_mcp_message
from core.utils.util import remove_punctuation_and_length, filter_sensitive_info
from core.handle.receiveAudioHandle import startToChat, handleAudioMessage
from core.handle.sendAudioHandle import send_stt_message, send_tts_message
@@ -76,7 +76,7 @@ async def handleTextMessage(conn, message):
elif msg_json["type"] == "mcp":
conn.logger.bind(tag=TAG).info(f"收到mcp消息:{message}")
if "payload" in msg_json:
asyncio.create_task(handleMCPMessage(conn, msg_json["payload"]))
asyncio.create_task(handle_mcp_message(conn, conn.mcp_client, msg_json["payload"]))
elif msg_json["type"] == "server":
# 记录日志时过滤敏感信息
conn.logger.bind(tag=TAG).info(