add minimax support

This commit is contained in:
abnerhexu
2026-01-23 17:53:57 +08:00
parent 0410fbf4bc
commit 77264c172f
6 changed files with 43 additions and 158 deletions

View File

@@ -118,9 +118,9 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Get detailed status of a specific drone including position, battery, heading, and visited targets.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
Example: {{"drone_id": "04d6cfe7"}}
"""
try:
params = json.loads(input_json) if isinstance(input_json, str) else input_json
@@ -141,7 +141,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Get drones, targets, and obstacles near a specific drone (within its perception radius).
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -164,7 +164,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Command a drone to land at its current position.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -187,7 +187,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Command a drone to hover at its current position.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- duration: Optional duration in seconds to hover (optional)
Example: {{"drone_id": "drone-001", "duration": 5.0}}
@@ -212,7 +212,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Command a drone to return to its home position.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -235,7 +235,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Set the drone's current position as its new home position.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -258,7 +258,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Calibrate the drone's sensors.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -281,7 +281,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Command a drone to take a photo.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
Example: {{"drone_id": "drone-001"}}
"""
@@ -307,7 +307,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
Drone must be on ground (idle or ready status).
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- altitude: Target altitude in meters (optional, default: 10.0)
Example: {{"drone_id": "drone-001", "altitude": 15.0}}
@@ -332,7 +332,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Change a drone's altitude while maintaining X/Y position.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- altitude: Target altitude in meters (required)
Example: {{"drone_id": "drone-001", "altitude": 20.0}}
@@ -360,7 +360,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
0=North, 90=East, 180=South, 270=West.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- heading: Target heading in degrees 0-360 (required)
Example: {{"drone_id": "drone-001", "heading": 90.0}}
@@ -387,8 +387,8 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Send a message from one drone to another.
Input should be a JSON string with:
- drone_id: The ID of the sender drone (required)
- target_drone_id: The ID of the recipient drone (required)
- drone_id: The ID of the sender drone (required, get from Action list_drones)
- target_drone_id: The ID of the recipient drone (required, get from Action list_drones)
- message: The message content (required)
Example: {{"drone_id": "drone-001", "target_drone_id": "drone-002", "message": "Hello"}}
@@ -418,7 +418,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Broadcast a message from one drone to all other drones.
Input should be a JSON string with:
- drone_id: The ID of the sender drone (required)
- drone_id: The ID of the sender drone (required, get from Action list_drones)
- message: The message content (required)
Example: {{"drone_id": "drone-001", "message": "Alert"}}
@@ -446,7 +446,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
Drone must be landed at a charging station.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- charge_amount: Amount to charge in percent (required)
Example: {{"drone_id": "drone-001", "charge_amount": 25.0}}
@@ -473,7 +473,7 @@ def create_uav_tools(client: UAVAPIClient) -> list:
"""Move a drone a specific distance in a direction.
Input should be a JSON string with:
- drone_id: The ID of the drone (required)
- drone_id: The ID of the drone (required, get from Action list_drones)
- distance: Distance to move in meters (required)
- heading: Heading direction in degrees 0-360 (optional, default: current heading)
- dz: Vertical component in meters (optional)
@@ -578,6 +578,8 @@ def create_uav_tools(client: UAVAPIClient) -> list:
return "Error: x, y, and z coordinates are required"
result = client.move_to(drone_id, x, y, z)
if result["status"] == "error":
result["message"] += " If the task is to move a certain distance in a specific direction but the path is blocked by an obstacle, first move a certain distance in another direction within the plane, and then proceed to move in the target direction. Do not alter the intended distance of movement in the target direction unless explicitly permitted by the task. You may invoke `get_obstacles` to observe the positions of obstacles."
return json.dumps(result, indent=2)
except json.JSONDecodeError as e:
return f"Error parsing JSON input: {str(e)}. Expected format: {{\"drone_id\": \"drone-001\", \"x\": 100.0, \"y\": 50.0, \"z\": 20.0}}"