mirror of
https://github.com/deepmodeling/Uni-Lab-OS
synced 2026-03-24 09:17:39 +00:00
add create_resource schema
This commit is contained in:
@@ -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))
|
||||
),
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user