add create_resource schema

This commit is contained in:
Xuwznln
2026-03-10 15:27:39 +08:00
parent 38bf95b13c
commit 95d3456214
2 changed files with 20 additions and 4 deletions

View File

@@ -97,6 +97,18 @@ class Registry:
)
test_resource_schema["description"] = "用于测试物料、设备和样本。"
create_resource_method_info = host_node_enhanced_info.get("action_methods", {}).get("create_resource", {})
create_resource_schema = self._generate_unilab_json_command_schema(
create_resource_method_info.get("args", []),
"create_resource",
create_resource_method_info.get("return_annotation"),
)
create_resource_schema["description"] = "用于创建物料"
raw_create_resource_schema = ros_action_to_json_schema(
self.ResourceCreateFromOuterEasy, "用于创建或更新物料资源,每次传入一个物料信息。"
)
raw_create_resource_schema["properties"]["result"] = create_resource_schema["properties"]["result"]
self.device_type_registry.update(
{
"host_node": {
@@ -140,9 +152,7 @@ class Registry:
},
"feedback": {},
"result": {"success": "success"},
"schema": ros_action_to_json_schema(
self.ResourceCreateFromOuterEasy, "用于创建或更新物料资源,每次传入一个物料信息。"
),
"schema": raw_create_resource_schema,
"goal_default": yaml.safe_load(
io.StringIO(get_yaml_from_goal_type(self.ResourceCreateFromOuterEasy.Goal))
),

View File

@@ -68,6 +68,12 @@ class TestResourceReturn(TypedDict):
unilabos_samples: List[LabSample]
class CreateResourceReturn(TypedDict):
created_resource_tree: List[List[ResourceDict]]
liquid_input_resource_tree: List[Dict[str, Any]]
unilabos_samples: List[LabSample]
class TestLatencyReturn(TypedDict):
"""test_latency方法的返回值类型"""
@@ -556,7 +562,7 @@ class HostNode(BaseROS2DeviceNode):
liquid_type: list[str] = [],
liquid_volume: list[int] = [],
slot_on_deck: str = "",
):
) -> CreateResourceReturn:
# 暂不支持多对同名父子同时存在
res_creation_input = {
"id": res_id.split("/")[-1],