[2025-12-02 21:36:22] ================================================================================
[2025-12-02 21:36:22] --- API Test: Generate Plan ---
[2025-12-02 21:36:22] URL: http://127.0.0.1:8000/generate_plan
[2025-12-02 21:36:22] Sending Prompt: "已知目标检测红色气球危险性高于蓝色气球高于绿色气球，飞往搜索区搜索并锁定危险性最高的气球，对其跟踪30秒后进行打击操作"
[2025-12-02 21:36:22] ❌ TEST FAILED: Could not connect to the server.
                         Please make sure the backend service is running.
                         Error details: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /generate_plan (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7d2dd27230>: Failed to establish a new connection: [Errno 111] Connection refused'))
[2025-12-02 21:36:22] ================================================================================
[2025-12-02 21:36:22] 
[2025-12-02 21:38:38] ================================================================================
[2025-12-02 21:38:38] --- API Test: Generate Plan ---
[2025-12-02 21:38:38] URL: http://127.0.0.1:8000/generate_plan
[2025-12-02 21:38:38] Sending Prompt: "已知目标检测红色气球危险性高于蓝色气球高于绿色气球，飞往搜索区搜索并锁定危险性最高的气球，对其跟踪30秒后进行打击操作"
[2025-12-02 21:38:51] ✅ Received Response:
[2025-12-02 21:38:51] 
                      📝 组织后的Prompt:
[2025-12-02 21:38:51] === System Prompt ===
                      任务：根据用户任意任务指令，生成结构化可执行的无人机行为树（Pytree）JSON。**仅输出单一JSON对象，无任何自然语言、注释或额外内容**。
                      
                      ## 一、核心节点定义（格式不可修改，确保后端解析）
                      #### 1. 可用节点定义 (必须遵守)
                      你必须严格从以下JSON定义的列表中选择节点构建行为树，不允许使用未定义节点：
                      ```json
                      {
                        "actions": [
                          {"name":"takeoff","params":{"altitude":"float[1,100]，默认2"}},
                          {"name":"land","params":{"mode":"'current'/'home'"}},
                          {"name":"fly_to_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","acceptance_radius":"默认2.0"}},
                          {"name":"move_direction","params":{"direction":"north/south/east/west/forward/backward/left/right","distance":"[1,10000]，缺省持续移动"}},
                          {"name":"orbit_around_point","params":{"center_x":"±10000","center_y":"±10000","center_z":"[1,5000]","radius":"[5,1000]","laps":"[1,20]","clockwise":"默认true","speed_mps":"[0.5,15]","gimbal_lock":"默认true"}},
                          {"name":"orbit_around_target","params":{"target_class":"见object_detect列表","description":"可选，目标属性","radius":"[5,1000]","laps":"[1,20]","clockwise":"默认true","speed_mps":"[0.5,15]","gimbal_lock":"默认true"}},
                          {"name":"loiter","params":{"duration":"[1,600]秒/until_condition:可选"}},
                          {"name":"object_detect","params":{"target_class":"person,bicycle,car,motorcycle,airplane,bus,train,truck,boat,traffic_light,fire_hydrant,stop_sign,parking_meter,bench,bird,cat,dog,horse,sheep,cow,elephant,bear,zebra,giraffe,backpack,umbrella,handbag,tie,suitcase,frisbee,skis,snowboard,sports_ball,kite,baseball_bat,baseball_glove,skateboard,surfboard,tennis_racket,bottle,wine_glass,cup,fork,knife,spoon,bowl,banana,apple,sandwich,orange,broccoli,carrot,hot_dog,pizza,donut,cake,chair,couch,potted_plant,bed,dining_table,toilet,tv,laptop,mouse,remote,keyboard,cell_phone,microwave,oven,toaster,sink,refrigerator,book,clock,vase,scissors,teddy_bear,hair_drier,toothbrush","description":"可选，","count":"默认1"}},
                          {"name":"strike_target","params":{"target_class":"同object_detect","description":"可选，目标属性","count":"默认1"}},
                          {"name":"battle_damage_assessment","params":{"target_class":"同object_detect","assessment_time":"[5,60]，默认15"}},
                          {"name":"search_pattern","params":{"pattern_type":"spiral/grid","center_x":"±10000","center_y":"±10000","center_z":"[1,5000]","radius":"[5,1000]","target_class":"同object_detect","description":"可选，目标属性","count":"默认1"}},
                          {"name":"track_object","params":{"target_class":"同object_detect","description":"可选，目标属性","track_time":"[1,600]秒（必传，不可用'duration'）","min_confidence":"[0.5,1.0]默认0.7","safe_distance":"[2,50]默认10"}},
                          {"name":"deliver_payload","params":{"payload_type":"string","release_altitude":"[2,100]默认5"}},
                          {"name":"preflight_checks","params":{"check_level":"basic/comprehensive"}},
                          {"name":"emergency_return","params":{"reason":"string"}}
                        ],
                        "conditions": [
                          {"name":"battery_above","params":{"threshold":"[0.0,1.0]，必传"}},
                          {"name":"at_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","tolerance":"默认3.0"}},
                          {"name":"object_detected","params":{"target_class":"同object_detect（必传）","description":"可选，目标属性","count":"默认1"}},
                          {"name":"target_destroyed","params":{"target_class":"同object_detect","description":"可选，目标属性","confidence":"[0.5,1.0]默认0.8"}},
                          {"name":"time_elapsed","params":{"duration":"[1,2700]秒"}},
                          {"name":"gps_status","params":{"min_satellites":"int[6,15]，必传（如8）"}}
                        ],
                        "control_flow": [
                          {"name":"Sequence","params":{},"children":"子节点数组（按序执行，全成功则成功）"},
                          {"name":"Selector","params":{"memory":"默认true"},"children":"子节点数组（执行到成功为止）"},
                          {"name":"Parallel","params":{"policy":"all_success"},"children":"子节点数组（同时执行，严禁用'one_success'）"}
                        ]
                      }
                      ```
                      
                      
                      ## 二、节点必填字段（后端Schema强制要求，缺一验证失败）
                      每个节点必须包含以下字段，字段名/类型不可自定义：
                      1. **`type`**：  
                         - 动作节点→`"action"`，条件节点→`"condition"`，控制流节点→`"Sequence"`/`"Selector"`/`"Parallel"`（与`name`字段值完全一致）；
                      2. **`name`**：必须是上述JSON中`actions`/`conditions`/`control_flow`下的`name`值（如“gps_status”不可错写为“gps_check”）；
                      3. **`params`**：严格匹配上述节点的`params`定义，无自定义参数（如优先级排序不可加“priority”字段，仅用`description`）；
                      4. **`children`**：仅控制流节点必含（子节点数组），动作/条件节点无此字段。
                      
                      
                      ## 三、行为树固定结构（通用不变，确保安全验证）
                      根节点必须是`Parallel`，`children`含`MainTask`（Sequence）和`SafetyMonitor`（Selector），结构不随任务类型（含优先级排序）修改：
                      ```json
                      {
                        "root": {
                          "type": "Parallel",
                          "name": "MissionWithSafety",
                          "params": {"policy": "all_success"},
                          "children": [
                            {
                              "type": "Sequence",
                              "name": "MainTask",
                              "params": {},
                              "children": [
                                // 通用主任务步骤（含优先级排序任务示例，需按用户指令替换）：
                                {"type":"action","name":"preflight_checks","params":{"check_level":"comprehensive"}},
                                {"type":"action","name":"takeoff","params":{"altitude":10.0}},
                                {"type":"action","name":"fly_to_waypoint","params":{"x":200.0,"y":150.0,"z":10.0}}, // 搜索区坐标（用户未给时填合理值）
                                {"type":"action","name":"search_pattern","params":{"pattern_type":"grid","center_x":200.0,"center_y":150.0,"center_z":10.0,"radius":50.0,"target_class":"balloon","description":"红色"}},
                                {"type":"condition","name":"object_detected","params":{"target_class":"balloon","description":"红色"}}, // 确认高优先级目标
                                {"type":"action","name":"track_object","params":{"target_class":"balloon","description":"红色","track_time":30.0}},
                                {"type":"action","name":"strike_target","params":{"target_class":"balloon","description":"红色"}},
                                {"type":"action","name":"land","params":{"mode":"home"}}
                              ]
                            },
                            {
                              "type": "Selector",
                              "name": "SafetyMonitor",
                              "params": {"memory": true},
                              "children": [
                                {"type":"condition","name":"battery_above","params":{"threshold":0.3}},
                                {"type":"condition","name":"gps_status","params":{"min_satellites":8}},
                                {
                                  "type":"Sequence",
                                  "name":"EmergencyHandler",
                                  "params": {},
                                  "children": [
                                    {"type":"action","name":"emergency_return","params":{"reason":"safety_breach"}},
                                    {"type":"action","name":"land","params":{"mode":"home"}}
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      }
                      ```
                      
                      
                      ## 四、优先级排序任务通用示例
                      当用户指令中明确提出有多个待考察且具有优先级关系的物体时，节点描述须为优先级关系。比如当指令为已知有三个气球，危险级关系为红色气球大于蓝色气球大于绿色气球，要求优先跟踪最危险的气球时，节点的描述参考下表情形。
                      | 用户指令场景                | `target_class`  | `description`          | 核心节点示例（search_pattern）                                                                 |
                      |-----------------------------|-----------------|-------------------------|------------------------------------------------------------------------------------------------|
                      | 红气球＞蓝气球＞绿气球      | `balloon`    | `（红＞蓝＞绿）`        | `{"type":"action","name":"search_pattern","params":{"pattern_type":"grid","center_x":200,"center_y":150,"center_z":10,"radius":50,"target_class":"balloon","description":"（红＞蓝＞绿）"}}` |
                      | 军用卡车＞民用卡车＞面包车  | `truck`         | `（军用卡车＞民用卡车＞面包车）` | `{"type":"action","name":"object_detect","params":{"target_class":"truck","description":"（军用卡车＞民用卡车＞面包车）"}}` |
                      
                      
                      ## 五、高频错误规避（确保验证通过）
                      1. 优先级排序不可修改`target_class`：如“民用卡车、面包车与军用卡车中，军用卡车优先”，`target_class`仍为`truck`，仅用`description`填排序规则；
                      2. 在没有明确指出物体之间的优先级关系情况下，`description`字段只描述物体属性本身，严禁与用户指令中不存在的物体进行排序；
                      3. `track_object`必传`track_time`：不可用`duration`替代（如跟踪30秒填`"track_time":30.0`）；
                      4. `gps_status`的`min_satellites`必须在6-15之间（如8，不可缺省）；
                      5. 无自定义节点：“锁定高优先级目标”需通过`object_detect`+`object_detected`实现，不可用“lock_high_risk_target”。
                      
                      
                      ## 六、输出要求
                      仅输出1个严格符合上述所有规则的JSON对象，**确保：1. 优先级排序逻辑正确填入`description`；2. `target_class`匹配预定义列表；3. 行为树结构不变；4. 后端解析与Schema验证无错误**，无任何冗余内容。
                      
                      
                      【强制规则】仅生成包含root的复杂行为树JSON，不得输出简单模式（不得包含mode字段或仅有action节点）。
                      
                      === User Prompt ===
                      已知目标检测红色气球危险性高于蓝色气球高于绿色气球，飞往搜索区搜索并锁定危险性最高的气球，对其跟踪30秒后进行打击操作
                      
                      ---
                      参考知识：
                      以下是从知识库中检索到的、与当前任务最相关的信息，请优先参考这些信息来生成结果：
                      在地图上有一个名为 '学生宿舍' 的地点或区域，它的building是'dormitory'，其中心位置坐标大约在 (x:5, y:3, z:2)。
                      
                      在地图上有一个名为 '跷跷板' 的地点或区域，它的leisure是'playground'，其中心位置坐标大约在 (x:15, y:-8.5, z:1.2)。
                      
                      在地图上有一个名为 'A地' 的地点或区域，它的building是'commercial'，其中心位置坐标大约在 (x:10, y:-10, z:2)。
                      ---
[2025-12-02 21:38:51] 
                      完整响应内容:
[2025-12-02 21:38:51] {
                        "root": {
                          "type": "Parallel",
                          "name": "MissionWithSafety",
                          "params": {
                            "policy": "all_success"
                          },
                          "children": [
                            {
                              "type": "Sequence",
                              "name": "MainTask",
                              "params": {},
                              "children": [
                                {
                                  "type": "action",
                                  "name": "preflight_checks",
                                  "params": {
                                    "check_level": "comprehensive"
                                  }
                                },
                                {
                                  "type": "action",
                                  "name": "takeoff",
                                  "params": {
                                    "altitude": 10.0
                                  }
                                },
                                {
                                  "type": "action",
                                  "name": "fly_to_waypoint",
                                  "params": {
                                    "x": 15.0,
                                    "y": -8.5,
                                    "z": 1.2
                                  }
                                },
                                {
                                  "type": "action",
                                  "name": "search_pattern",
                                  "params": {
                                    "pattern_type": "grid",
                                    "center_x": 15.0,
                                    "center_y": -8.5,
                                    "center_z": 1.1,
                                    "radius": 50.0,
                                    "target_class": "balloon",
                                    "description": "（红＞蓝＞绿）"
                                  }
                                },
                                {
                                  "type": "condition",
                                  "name": "object_detected",
                                  "params": {
                                    "target_class": "balloon",
                                    "description": "（红＞蓝＞绿）"
                                  }
                                },
                                {
                                  "type": "action",
                                  "name": "track_object",
                                  "params": {
                                    "target_class": "balloon",
                                    "description": "（红＞蓝＞绿）",
                                    "track_time": 30.0
                                  }
                                },
                                {
                                  "type": "action",
                                  "name": "strike_target",
                                  "params": {
                                    "target_class": "balloon",
                                    "description": "（红＞蓝＞绿）"
                                  }
                                }
                              ]
                            },
                            {
                              "type": "Selector",
                              "name": "SafetyMonitor",
                              "params": {
                                "memory": true
                              },
                              "children": [
                                {
                                  "type": "condition",
                                  "name": "battery_above",
                                  "params": {
                                    "threshold": 0.3
                                  }
                                },
                                {
                                  "type": "condition",
                                  "name": "gps_status",
                                  "params": {
                                    "min_satellites": 8
                                  }
                                },
                                {
                                  "type": "Sequence",
                                  "name": "EmergencyHandler",
                                  "params": {},
                                  "children": [
                                    {
                                      "type": "action",
                                      "name": "emergency_return",
                                      "params": {
                                        "reason": "safety_breach"
                                      }
                                    },
                                    {
                                      "type": "action",
                                      "name": "land",
                                      "params": {
                                        "mode": "home"
                                      }
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        "plan_id": "a4ed4c91-a277-4ab5-b3c1-7fd351f0e844",
                        "visualization_url": "/static/py_tree.png",
                        "final_prompt": "=== System Prompt ===\n任务：根据用户任意任务指令，生成结构化可执行的无人机行为树（Pytree）JSON。**仅输出单一JSON对象，无任何自然语言、注释或额外内容**。\n\n## 一、核心节点定义（格式不可修改，确保后端解析）\n#### 1. 可用节点定义 (必须遵守)\n你必须严格从以下JSON定义的列表中选择节点构建行为树，不允许使用未定义节点：\n```json\n{\n  \"actions\": [\n    {\"name\":\"takeoff\",\"params\":{\"altitude\":\"float[1,100]，默认2\"}},\n    {\"name\":\"land\",\"params\":{\"mode\":\"'current'/'home'\"}},\n    {\"name\":\"fly_to_waypoint\",\"params\":{\"x\":\"±10000\",\"y\":\"±10000\",\"z\":\"[1,5000]\",\"acceptance_radius\":\"默认2.0\"}},\n    {\"name\":\"move_direction\",\"params\":{\"direction\":\"north/south/east/west/forward/backward/left/right\",\"distance\":\"[1,10000]，缺省持续移动\"}},\n    {\"name\":\"orbit_around_point\",\"params\":{\"center_x\":\"±10000\",\"center_y\":\"±10000\",\"center_z\":\"[1,5000]\",\"radius\":\"[5,1000]\",\"laps\":\"[1,20]\",\"clockwise\":\"默认true\",\"speed_mps\":\"[0.5,15]\",\"gimbal_lock\":\"默认true\"}},\n    {\"name\":\"orbit_around_target\",\"params\":{\"target_class\":\"见object_detect列表\",\"description\":\"可选，目标属性\",\"radius\":\"[5,1000]\",\"laps\":\"[1,20]\",\"clockwise\":\"默认true\",\"speed_mps\":\"[0.5,15]\",\"gimbal_lock\":\"默认true\"}},\n    {\"name\":\"loiter\",\"params\":{\"duration\":\"[1,600]秒/until_condition:可选\"}},\n    {\"name\":\"object_detect\",\"params\":{\"target_class\":\"person,bicycle,car,motorcycle,airplane,bus,train,truck,boat,traffic_light,fire_hydrant,stop_sign,parking_meter,bench,bird,cat,dog,horse,sheep,cow,elephant,bear,zebra,giraffe,backpack,umbrella,handbag,tie,suitcase,frisbee,skis,snowboard,sports_ball,kite,baseball_bat,baseball_glove,skateboard,surfboard,tennis_racket,bottle,wine_glass,cup,fork,knife,spoon,bowl,banana,apple,sandwich,orange,broccoli,carrot,hot_dog,pizza,donut,cake,chair,couch,potted_plant,bed,dining_table,toilet,tv,laptop,mouse,remote,keyboard,cell_phone,microwave,oven,toaster,sink,refrigerator,book,clock,vase,scissors,teddy_bear,hair_drier,toothbrush\",\"description\":\"可选，\",\"count\":\"默认1\"}},\n    {\"name\":\"strike_target\",\"params\":{\"target_class\":\"同object_detect\",\"description\":\"可选，目标属性\",\"count\":\"默认1\"}},\n    {\"name\":\"battle_damage_assessment\",\"params\":{\"target_class\":\"同object_detect\",\"assessment_time\":\"[5,60]，默认15\"}},\n    {\"name\":\"search_pattern\",\"params\":{\"pattern_type\":\"spiral/grid\",\"center_x\":\"±10000\",\"center_y\":\"±10000\",\"center_z\":\"[1,5000]\",\"radius\":\"[5,1000]\",\"target_class\":\"同object_detect\",\"description\":\"可选，目标属性\",\"count\":\"默认1\"}},\n    {\"name\":\"track_object\",\"params\":{\"target_class\":\"同object_detect\",\"description\":\"可选，目标属性\",\"track_time\":\"[1,600]秒（必传，不可用'duration'）\",\"min_confidence\":\"[0.5,1.0]默认0.7\",\"safe_distance\":\"[2,50]默认10\"}},\n    {\"name\":\"deliver_payload\",\"params\":{\"payload_type\":\"string\",\"release_altitude\":\"[2,100]默认5\"}},\n    {\"name\":\"preflight_checks\",\"params\":{\"check_level\":\"basic/comprehensive\"}},\n    {\"name\":\"emergency_return\",\"params\":{\"reason\":\"string\"}}\n  ],\n  \"conditions\": [\n    {\"name\":\"battery_above\",\"params\":{\"threshold\":\"[0.0,1.0]，必传\"}},\n    {\"name\":\"at_waypoint\",\"params\":{\"x\":\"±10000\",\"y\":\"±10000\",\"z\":\"[1,5000]\",\"tolerance\":\"默认3.0\"}},\n    {\"name\":\"object_detected\",\"params\":{\"target_class\":\"同object_detect（必传）\",\"description\":\"可选，目标属性\",\"count\":\"默认1\"}},\n    {\"name\":\"target_destroyed\",\"params\":{\"target_class\":\"同object_detect\",\"description\":\"可选，目标属性\",\"confidence\":\"[0.5,1.0]默认0.8\"}},\n    {\"name\":\"time_elapsed\",\"params\":{\"duration\":\"[1,2700]秒\"}},\n    {\"name\":\"gps_status\",\"params\":{\"min_satellites\":\"int[6,15]，必传（如8）\"}}\n  ],\n  \"control_flow\": [\n    {\"name\":\"Sequence\",\"params\":{},\"children\":\"子节点数组（按序执行，全成功则成功）\"},\n    {\"name\":\"Selector\",\"params\":{\"memory\":\"默认true\"},\"children\":\"子节点数组（执行到成功为止）\"},\n    {\"name\":\"Parallel\",\"params\":{\"policy\":\"all_success\"},\"children\":\"子节点数组（同时执行，严禁用'one_success'）\"}\n  ]\n}\n```\n\n\n## 二、节点必填字段（后端Schema强制要求，缺一验证失败）\n每个节点必须包含以下字段，字段名/类型不可自定义：\n1. **`type`**：  \n   - 动作节点→`\"action\"`，条件节点→`\"condition\"`，控制流节点→`\"Sequence\"`/`\"Selector\"`/`\"Parallel\"`（与`name`字段值完全一致）；\n2. **`name`**：必须是上述JSON中`actions`/`conditions`/`control_flow`下的`name`值（如“gps_status”不可错写为“gps_check”）；\n3. **`params`**：严格匹配上述节点的`params`定义，无自定义参数（如优先级排序不可加“priority”字段，仅用`description`）；\n4. **`children`**：仅控制流节点必含（子节点数组），动作/条件节点无此字段。\n\n\n## 三、行为树固定结构（通用不变，确保安全验证）\n根节点必须是`Parallel`，`children`含`MainTask`（Sequence）和`SafetyMonitor`（Selector），结构不随任务类型（含优先级排序）修改：\n```json\n{\n  \"root\": {\n    \"type\": \"Parallel\",\n    \"name\": \"MissionWithSafety\",\n    \"params\": {\"policy\": \"all_success\"},\n    \"children\": [\n      {\n        \"type\": \"Sequence\",\n        \"name\": \"MainTask\",\n        \"params\": {},\n        \"children\": [\n          // 通用主任务步骤（含优先级排序任务示例，需按用户指令替换）：\n          {\"type\":\"action\",\"name\":\"preflight_checks\",\"params\":{\"check_level\":\"comprehensive\"}},\n          {\"type\":\"action\",\"name\":\"takeoff\",\"params\":{\"altitude\":10.0}},\n          {\"type\":\"action\",\"name\":\"fly_to_waypoint\",\"params\":{\"x\":200.0,\"y\":150.0,\"z\":10.0}}, // 搜索区坐标（用户未给时填合理值）\n          {\"type\":\"action\",\"name\":\"search_pattern\",\"params\":{\"pattern_type\":\"grid\",\"center_x\":200.0,\"center_y\":150.0,\"center_z\":10.0,\"radius\":50.0,\"target_class\":\"balloon\",\"description\":\"红色\"}},\n          {\"type\":\"condition\",\"name\":\"object_detected\",\"params\":{\"target_class\":\"balloon\",\"description\":\"红色\"}}, // 确认高优先级目标\n          {\"type\":\"action\",\"name\":\"track_object\",\"params\":{\"target_class\":\"balloon\",\"description\":\"红色\",\"track_time\":30.0}},\n          {\"type\":\"action\",\"name\":\"strike_target\",\"params\":{\"target_class\":\"balloon\",\"description\":\"红色\"}},\n          {\"type\":\"action\",\"name\":\"land\",\"params\":{\"mode\":\"home\"}}\n        ]\n      },\n      {\n        \"type\": \"Selector\",\n        \"name\": \"SafetyMonitor\",\n        \"params\": {\"memory\": true},\n        \"children\": [\n          {\"type\":\"condition\",\"name\":\"battery_above\",\"params\":{\"threshold\":0.3}},\n          {\"type\":\"condition\",\"name\":\"gps_status\",\"params\":{\"min_satellites\":8}},\n          {\n            \"type\":\"Sequence\",\n            \"name\":\"EmergencyHandler\",\n            \"params\": {},\n            \"children\": [\n              {\"type\":\"action\",\"name\":\"emergency_return\",\"params\":{\"reason\":\"safety_breach\"}},\n              {\"type\":\"action\",\"name\":\"land\",\"params\":{\"mode\":\"home\"}}\n            ]\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n\n## 四、优先级排序任务通用示例\n当用户指令中明确提出有多个待考察且具有优先级关系的物体时，节点描述须为优先级关系。比如当指令为已知有三个气球，危险级关系为红色气球大于蓝色气球大于绿色气球，要求优先跟踪最危险的气球时，节点的描述参考下表情形。\n| 用户指令场景                | `target_class`  | `description`          | 核心节点示例（search_pattern）                                                                 |\n|-----------------------------|-----------------|-------------------------|------------------------------------------------------------------------------------------------|\n| 红气球＞蓝气球＞绿气球      | `balloon`    | `（红＞蓝＞绿）`        | `{\"type\":\"action\",\"name\":\"search_pattern\",\"params\":{\"pattern_type\":\"grid\",\"center_x\":200,\"center_y\":150,\"center_z\":10,\"radius\":50,\"target_class\":\"balloon\",\"description\":\"（红＞蓝＞绿）\"}}` |\n| 军用卡车＞民用卡车＞面包车  | `truck`         | `（军用卡车＞民用卡车＞面包车）` | `{\"type\":\"action\",\"name\":\"object_detect\",\"params\":{\"target_class\":\"truck\",\"description\":\"（军用卡车＞民用卡车＞面包车）\"}}` |\n\n\n## 五、高频错误规避（确保验证通过）\n1. 优先级排序不可修改`target_class`：如“民用卡车、面包车与军用卡车中，军用卡车优先”，`target_class`仍为`truck`，仅用`description`填排序规则；\n2. 在没有明确指出物体之间的优先级关系情况下，`description`字段只描述物体属性本身，严禁与用户指令中不存在的物体进行排序；\n3. `track_object`必传`track_time`：不可用`duration`替代（如跟踪30秒填`\"track_time\":30.0`）；\n4. `gps_status`的`min_satellites`必须在6-15之间（如8，不可缺省）；\n5. 无自定义节点：“锁定高优先级目标”需通过`object_detect`+`object_detected`实现，不可用“lock_high_risk_target”。\n\n\n## 六、输出要求\n仅输出1个严格符合上述所有规则的JSON对象，**确保：1. 优先级排序逻辑正确填入`description`；2. `target_class`匹配预定义列表；3. 行为树结构不变；4. 后端解析与Schema验证无错误**，无任何冗余内容。\n\n\n【强制规则】仅生成包含root的复杂行为树JSON，不得输出简单模式（不得包含mode字段或仅有action节点）。\n\n=== User Prompt ===\n已知目标检测红色气球危险性高于蓝色气球高于绿色气球，飞往搜索区搜索并锁定危险性最高的气球，对其跟踪30秒后进行打击操作\n\n---\n参考知识：\n以下是从知识库中检索到的、与当前任务最相关的信息，请优先参考这些信息来生成结果：\n在地图上有一个名为 '学生宿舍' 的地点或区域，它的building是'dormitory'，其中心位置坐标大约在 (x:5, y:3, z:2)。\n\n在地图上有一个名为 '跷跷板' 的地点或区域，它的leisure是'playground'，其中心位置坐标大约在 (x:15, y:-8.5, z:1.2)。\n\n在地图上有一个名为 'A地' 的地点或区域，它的building是'commercial'，其中心位置坐标大约在 (x:10, y:-10, z:2)。\n---"
                      }
[2025-12-02 21:38:51] 
                      --- Validation Checks ---
[2025-12-02 21:38:51] PASS: Response is a valid JSON object.
[2025-12-02 21:38:51] PASS: Response contains a valid 'root' key.
[2025-12-02 21:38:51] PASS: Response contains a valid 'visualization_url': /static/py_tree.png
[2025-12-02 21:38:51] ✅ Test completed successfully
[2025-12-02 21:38:51] ================================================================================
[2025-12-02 21:38:51] 
