Update version to 0.1.17, enhance NavServer with patrol functionality, and modify MQTT broker default value. Added patrol command handling and updated documentation for new parameters.
This commit is contained in:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "terminal_temi_mcp"
|
name = "terminal_temi_mcp"
|
||||||
version = "0.1.15"
|
version = "0.1.17"
|
||||||
description = "MQTT-based navigation server for robot"
|
description = "MQTT-based navigation server for robot"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -90,8 +90,7 @@ class NavServer:
|
|||||||
"""
|
"""
|
||||||
机器人接待客人。
|
机器人接待客人。
|
||||||
Args:
|
Args:
|
||||||
- location (str): 机器人去这个位置接待客人
|
- location (str): 机器人接待客人到这个位置
|
||||||
- task_id (Optional[str]): 任务id,不传则自动生成
|
|
||||||
Returns:
|
Returns:
|
||||||
str: 命令执行结果消息
|
str: 命令执行结果消息
|
||||||
|
|
||||||
@@ -116,8 +115,7 @@ class NavServer:
|
|||||||
机器人通知事情。
|
机器人通知事情。
|
||||||
Args:
|
Args:
|
||||||
- location (str): 机器人去这个位置通知事情
|
- location (str): 机器人去这个位置通知事情
|
||||||
- text (str): 通知事情的内容
|
- text (str): 通知的内容
|
||||||
- task_id (Optional[str]): 任务id,不传则自动生成
|
|
||||||
Returns:
|
Returns:
|
||||||
str: 命令执行结果消息
|
str: 命令执行结果消息
|
||||||
|
|
||||||
@@ -158,7 +156,6 @@ class NavServer:
|
|||||||
Args:
|
Args:
|
||||||
- first_location (str): 机器人去这个位置取物品
|
- first_location (str): 机器人去这个位置取物品
|
||||||
- next_location (str): 机器人将物品送到这个位置
|
- next_location (str): 机器人将物品送到这个位置
|
||||||
- task_id (Optional[str]): 任务id,不传则自动生成
|
|
||||||
Returns:
|
Returns:
|
||||||
str: 命令执行结果消息
|
str: 命令执行结果消息
|
||||||
|
|
||||||
@@ -180,6 +177,28 @@ class NavServer:
|
|||||||
logger.error(f"Failed to call delivery mcp-tool: {str(e)} ", exc_info=True)
|
logger.error(f"Failed to call delivery mcp-tool: {str(e)} ", exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
async def patrol(self, locations: list[str]):
|
||||||
|
"""
|
||||||
|
机器人去巡逻。
|
||||||
|
Args:
|
||||||
|
- locations (list[str]): 机器人巡逻经过的地点列表
|
||||||
|
Returns:
|
||||||
|
str: 命令执行结果消息
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: 如果参数无效或为空
|
||||||
|
Exception: 如果MQTT发布失败
|
||||||
|
"""
|
||||||
|
if locations:
|
||||||
|
try:
|
||||||
|
params = {
|
||||||
|
"data": {"locations": locations}
|
||||||
|
}
|
||||||
|
return await self.publish_Cmd("123456", "patrol", params)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to call patrol mcp-tool: {str(e)} ", exc_info=True)
|
||||||
|
raise
|
||||||
|
|
||||||
async def startFaceRecognize(self, device_id: str):
|
async def startFaceRecognize(self, device_id: str):
|
||||||
"""
|
"""
|
||||||
机器人进行人脸识别。
|
机器人进行人脸识别。
|
||||||
@@ -374,6 +393,23 @@ async def serve() -> None:
|
|||||||
"required": ["first_location","next_location"]
|
"required": ["first_location","next_location"]
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
Tool(
|
||||||
|
name="patrol",
|
||||||
|
description="数字员工、终端、具身机器人、前台机器人、助手、机器人去巡逻:巡逻、巡查、去检查一下、去看看、去巡视",
|
||||||
|
inputSchema={
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"locations": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "机器人巡逻经过的地点列表",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["locations"]
|
||||||
|
}
|
||||||
|
),
|
||||||
# Tool(
|
# Tool(
|
||||||
# name="guide",
|
# name="guide",
|
||||||
# description="数字员工、终端、具身机器人、前台机器人、助手、机器人进行导览服务:导览、介绍、参观、带领参观、导游、讲解、展示、演示、介绍场所、带我看看",
|
# description="数字员工、终端、具身机器人、前台机器人、助手、机器人进行导览服务:导览、介绍、参观、带领参观、导游、讲解、展示、演示、介绍场所、带我看看",
|
||||||
@@ -459,6 +495,12 @@ async def serve() -> None:
|
|||||||
first_location=arguments["first_location"],
|
first_location=arguments["first_location"],
|
||||||
next_location=arguments["next_location"]
|
next_location=arguments["next_location"]
|
||||||
)
|
)
|
||||||
|
elif name == "patrol":
|
||||||
|
if "locations" not in arguments:
|
||||||
|
raise ValueError("缺少必要参数: locations")
|
||||||
|
result = await nav_server.patrol(
|
||||||
|
locations=arguments["locations"]
|
||||||
|
)
|
||||||
# elif name == "face":
|
# elif name == "face":
|
||||||
# if "device_id" not in arguments:
|
# if "device_id" not in arguments:
|
||||||
# raise ValueError("缺少必要参数: device_id")
|
# raise ValueError("缺少必要参数: device_id")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class MQTTHandler:
|
|||||||
# 获取MQTT配置,提供默认值
|
# 获取MQTT配置,提供默认值
|
||||||
self.mqtt_username = getenv('MQTT_USERNAME') or 'lzwc'
|
self.mqtt_username = getenv('MQTT_USERNAME') or 'lzwc'
|
||||||
self.mqtt_password = getenv('MQTT_PASSWORD') or 'Lzwc@4187.'
|
self.mqtt_password = getenv('MQTT_PASSWORD') or 'Lzwc@4187.'
|
||||||
mqtt_broker_raw = getenv('MQTT_BROKER') or 'tcp://dempmana.lzwcai.com'
|
mqtt_broker_raw = getenv('MQTT_BROKER') or 'emqx'
|
||||||
# 移除协议前缀,只保留主机名
|
# 移除协议前缀,只保留主机名
|
||||||
self.mqtt_broker = mqtt_broker_raw.replace('tcp://', '').replace('mqtt://', '')
|
self.mqtt_broker = mqtt_broker_raw.replace('tcp://', '').replace('mqtt://', '')
|
||||||
mqtt_port_str = getenv('MQTT_PORT')
|
mqtt_port_str = getenv('MQTT_PORT')
|
||||||
|
|||||||
Reference in New Issue
Block a user