fix
This commit is contained in:
@@ -1316,6 +1316,61 @@ class DemandFlowApiTest {
|
||||
assertThat(generatedMatch(session, arm.path("analysisId").asText(), 3)).isEqualTo(arm.path("match"));
|
||||
}
|
||||
|
||||
@Test void armReplacementUsesTheNewHandPortIndexAndPreservesTheOriginalHand() throws Exception {
|
||||
defaultHumanoidModel(); humanoidComponents("sided");
|
||||
JsonNode fixture;
|
||||
try (java.io.InputStream stream = getClass().getResourceAsStream("/fixtures/arm-hand-port-shift.json")) {
|
||||
fixture = json.readTree(stream);
|
||||
}
|
||||
jdbc.update("UPDATE component SET urdf_info=? WHERE component_code=?", fixture.path("oldArmInfo").toString(), "CW-ARM_L");
|
||||
Session session = create(); JsonNode first = submit(session, "m1", "给我一个人形机器人", List.of());
|
||||
JsonNode before = handConnection(first.path("match"));
|
||||
assertThat(before.path("parentFrameIndex").asInt()).isEqualTo(2);
|
||||
assertThat(before.path("parentLink").asText()).isEqualTo("LINK2");
|
||||
duplicate("CW-ARM_L", "CW-ARM_L-NEW", "臂_L_臂3自由度左");
|
||||
jdbc.update("UPDATE component SET urdf_info=? WHERE component_code=?", fixture.path("newArmInfo").toString(), "CW-ARM_L-NEW");
|
||||
replacementModel("ARM", "L"); JsonNode replaced = submit(session, "m2", "换个左臂", List.of());
|
||||
assertThat(replaced.path("match").path("change").path("status").asText()).isEqualTo("applied");
|
||||
JsonNode after = handConnection(replaced.path("match"));
|
||||
assertThat(after.path("parentFrameIndex").asInt()).isEqualTo(3);
|
||||
assertThat(after.path("parentLink").asText()).isEqualTo("LINK_3");
|
||||
assertThat(after.path("parentFrame").asText()).isEqualTo("LINK_HAND_L");
|
||||
assertThat(after.path("childRootLink").asText()).isEqualTo("LINK_HAND_L");
|
||||
Map<String, String> expected = codesByRole(first.path("match")); expected.put("ARM_L:1", "CW-ARM_L-NEW");
|
||||
assertThat(codesByRole(replaced.path("match"))).isEqualTo(expected);
|
||||
assertThat(replaced.path("match").path("components")).hasSize(11);
|
||||
assertThat(replaced.path("match").path("assembly").path("connections")).hasSize(10);
|
||||
}
|
||||
|
||||
private JsonNode handConnection(JsonNode match) {
|
||||
for (JsonNode edge : match.path("assembly").path("connections")) {
|
||||
if (edge.path("childInstanceId").asText().endsWith(":HAND_L:1")) return edge;
|
||||
}
|
||||
throw new AssertionError("缺少左手连接");
|
||||
}
|
||||
|
||||
@Test void capturedRealModelAddLeftHandAfterArmReplacementGeneratesInsteadOfReplacing() throws Exception {
|
||||
defaultHumanoidModel(); humanoidComponents("sided");
|
||||
Session session = create(); submit(session, "m1", "给我一个人形机器人", List.of());
|
||||
duplicate("CW-HEAD_0", "CW-HEAD_0-NEW", "另一种头部"); replacementModel("HEAD", "all");
|
||||
submit(session, "m2", "换个头", List.of());
|
||||
duplicate("CW-ARM_L", "CW-ARM_L-NEW", "另一种左臂"); replacementModel("ARM", "L");
|
||||
JsonNode replaced = submit(session, "m3", "换个左臂", List.of());
|
||||
assertThat(codesByRole(replaced.path("match"))).containsEntry("HAND_L:1", "CW-HAND_L");
|
||||
assertThat(replaced.path("match").path("assembly").path("connections").toString()).contains(":HAND_L:1");
|
||||
try (java.io.InputStream stream = getClass().getResourceAsStream("/fixtures/add-left-hand-model-output.json")) {
|
||||
JsonNode captured = json.readTree(stream);
|
||||
doAnswer(invocation -> captured.deepCopy()).when(model).analyze(anyList());
|
||||
}
|
||||
JsonNode added = submit(session, "m4", "加上左手", List.of());
|
||||
assertThat(added.path("result").path("analysis").path("operation").path("type").asText()).isEqualTo("generate");
|
||||
assertThat(added.path("match").has("change")).isFalse();
|
||||
assertThat(codesByRole(added.path("match"))).containsEntry("HAND_L:1", "CW-HAND_L");
|
||||
assertThat(added.path("match").path("assembly").path("connections").toString()).contains(":HAND_L:1");
|
||||
assertThat(added.path("match").path("components")).hasSize(11);
|
||||
assertThat(generatedMatch(session, added.path("analysisId").asText(), 4)).isEqualTo(added.path("match"));
|
||||
}
|
||||
|
||||
@Test void headReplacementIgnoresRestatedHistoryAndInventedMissingParameters() throws Exception {
|
||||
defaultHumanoidModel(); humanoidComponents("sided");
|
||||
doAnswer(invocation -> {
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"summary": "当前为双足人形机器人方案,按当轮要求配置左手部件。",
|
||||
"intentItems": [
|
||||
{
|
||||
"id": "intent-1",
|
||||
"dimension": "form",
|
||||
"subject": "整机",
|
||||
"requirement": "为人形构型机器人",
|
||||
"priority": "must",
|
||||
"source": "explicit",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "intent-2",
|
||||
"dimension": "quantity",
|
||||
"subject": "整机",
|
||||
"requirement": "整机数量为1台",
|
||||
"priority": "must",
|
||||
"source": "explicit",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "intent-3",
|
||||
"dimension": "form",
|
||||
"subject": "左手",
|
||||
"requirement": "需配置左手部件",
|
||||
"priority": "must",
|
||||
"source": "explicit",
|
||||
"evidenceIds": [
|
||||
"obs-4"
|
||||
]
|
||||
}
|
||||
],
|
||||
"images": [],
|
||||
"observations": [
|
||||
{
|
||||
"id": "obs-1",
|
||||
"messageId": "m1",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "给我一个人形机器人",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
},
|
||||
{
|
||||
"id": "obs-2",
|
||||
"messageId": "m2",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "换个头",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
},
|
||||
{
|
||||
"id": "obs-3",
|
||||
"messageId": "m3",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "换个左臂",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
},
|
||||
{
|
||||
"id": "obs-4",
|
||||
"messageId": "m4",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "加上左手",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
{
|
||||
"term": "人形机器人",
|
||||
"source": "explicit",
|
||||
"reason": "",
|
||||
"negated": false,
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"term": "双足",
|
||||
"source": "inferred",
|
||||
"reason": "人形构型对应双足人形模板",
|
||||
"negated": false,
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"term": "左手",
|
||||
"source": "explicit",
|
||||
"reason": "",
|
||||
"negated": false,
|
||||
"evidenceIds": [
|
||||
"obs-4"
|
||||
]
|
||||
}
|
||||
],
|
||||
"robotTypes": [
|
||||
{
|
||||
"type": "biped",
|
||||
"source": "inferred",
|
||||
"reason": "用户要求人形机器人,采用双足人形模板",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"partCategories": [
|
||||
{
|
||||
"category": "TORSO_0",
|
||||
"source": "inferred",
|
||||
"reason": "人形机器人需要躯干",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "HEAD_0",
|
||||
"source": "inferred",
|
||||
"reason": "人形机器人通常包含头部",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "WAIST_0",
|
||||
"source": "inferred",
|
||||
"reason": "人形机器人通常包含腰部",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "HAND_L",
|
||||
"source": "explicit",
|
||||
"reason": "用户明确要求加上左手",
|
||||
"evidenceIds": [
|
||||
"obs-4"
|
||||
]
|
||||
}
|
||||
],
|
||||
"excludedCategories": [],
|
||||
"constraints": [
|
||||
{
|
||||
"scope": "robot",
|
||||
"categories": [],
|
||||
"field": "quantity",
|
||||
"value": "1",
|
||||
"upperValue": "",
|
||||
"operator": "eq",
|
||||
"evidenceIds": [
|
||||
"obs-1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"unmodeled": [],
|
||||
"questions": [],
|
||||
"operation": {
|
||||
"type": "replace",
|
||||
"targets": [
|
||||
{
|
||||
"family": "HAND",
|
||||
"side": "L",
|
||||
"instanceId": "",
|
||||
"ordinal": "",
|
||||
"evidenceIds": [
|
||||
"obs-4"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"summary" : "基于现有双足人形机器人有效方案,替换头部部件,并单独更换左臂部件,保持其余原有构型不变",
|
||||
"intentItems" : [ {
|
||||
"id" : "i1",
|
||||
"dimension" : "form",
|
||||
"subject" : "整机",
|
||||
"requirement" : "具备人形双足类人构型",
|
||||
"priority" : "must",
|
||||
"source" : "explicit",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
} ],
|
||||
"images" : [ ],
|
||||
"observations" : [ {
|
||||
"id" : "o1",
|
||||
"messageId" : "r1",
|
||||
"imageId" : "",
|
||||
"kind" : "user_text",
|
||||
"content" : "给我一个人形机器人",
|
||||
"clarity" : "clear",
|
||||
"region" : [ ]
|
||||
}, {
|
||||
"id" : "o2",
|
||||
"messageId" : "r2",
|
||||
"imageId" : "",
|
||||
"kind" : "user_text",
|
||||
"content" : "换个头",
|
||||
"clarity" : "clear",
|
||||
"region" : [ ]
|
||||
}, {
|
||||
"id" : "o3",
|
||||
"messageId" : "r3",
|
||||
"imageId" : "",
|
||||
"kind" : "user_text",
|
||||
"content" : "单独换个左臂",
|
||||
"clarity" : "clear",
|
||||
"region" : [ ]
|
||||
} ],
|
||||
"keywords" : [ {
|
||||
"term" : "人形机器人",
|
||||
"source" : "explicit",
|
||||
"reason" : "用户明确提出的核心机器人主体需求",
|
||||
"negated" : false,
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"term" : "双足",
|
||||
"source" : "inferred",
|
||||
"reason" : "人形机器人为双足构型,匹配biped模板特征",
|
||||
"negated" : false,
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"term" : "头部",
|
||||
"source" : "explicit",
|
||||
"reason" : "用户要求执行替换操作的目标部件",
|
||||
"negated" : false,
|
||||
"evidenceIds" : [ "o2" ]
|
||||
}, {
|
||||
"term" : "左臂",
|
||||
"source" : "explicit",
|
||||
"reason" : "用户要求单独执行替换操作的目标部件",
|
||||
"negated" : false,
|
||||
"evidenceIds" : [ "o3" ]
|
||||
} ],
|
||||
"robotTypes" : [ {
|
||||
"type" : "biped",
|
||||
"source" : "explicit",
|
||||
"reason" : "用户要求的人形机器人匹配biped双足机器人模板",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
} ],
|
||||
"partCategories" : [ {
|
||||
"category" : "TORSO_0",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板必需的躯干部件,构成机器人主体",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "HEAD_0",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的头部部件,为用户要求的替换目标",
|
||||
"evidenceIds" : [ "o1", "o2" ]
|
||||
}, {
|
||||
"category" : "WAIST_0",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板必需的腰部部件,连接躯干与下肢",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "ARM_L",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的左臂部件,为用户要求的单独替换目标",
|
||||
"evidenceIds" : [ "o1", "o3" ]
|
||||
}, {
|
||||
"category" : "ARM_R",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的右臂部件,构成人形双臂结构",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "HAND_L",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的左手部件,匹配左臂末端",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "HAND_R",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的右手部件,匹配右臂末端",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "LEG_L",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的左足部件,构成人形双足行走结构",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "LEG_R",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的右足部件,构成人形双足行走结构",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "FOOT_L",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的左脚部件,匹配左足末端",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
}, {
|
||||
"category" : "FOOT_R",
|
||||
"source" : "explicit",
|
||||
"reason" : "biped模板包含的右脚部件,匹配右足末端",
|
||||
"evidenceIds" : [ "o1" ]
|
||||
} ],
|
||||
"excludedCategories" : [ ],
|
||||
"constraints" : [ ],
|
||||
"unmodeled" : [ ],
|
||||
"questions" : [ ],
|
||||
"operation" : {
|
||||
"type" : "replace",
|
||||
"targets" : [ {
|
||||
"family" : "HEAD",
|
||||
"side" : "all",
|
||||
"instanceId" : "",
|
||||
"ordinal" : "",
|
||||
"evidenceIds" : [ "o2" ]
|
||||
}, {
|
||||
"family" : "ARM",
|
||||
"side" : "L",
|
||||
"instanceId" : "",
|
||||
"ordinal" : "",
|
||||
"evidenceIds" : [ "o3" ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"summary": "用户需求为生成具有类人形态的双足人形机器人,在现有方案基础上更换头部部件,未明确其余具体性能、材料、尺寸等参数。",
|
||||
"intentItems": [
|
||||
{
|
||||
"id": "item-001",
|
||||
"dimension": "form",
|
||||
"subject": "整机",
|
||||
"requirement": "具有类人人形形态",
|
||||
"priority": "must",
|
||||
"source": "explicit",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
}
|
||||
],
|
||||
"images": [],
|
||||
"observations": [
|
||||
{
|
||||
"id": "obs-001",
|
||||
"messageId": "m1",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "给我一个人形机器人",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
},
|
||||
{
|
||||
"id": "obs-002",
|
||||
"messageId": "m2",
|
||||
"imageId": "",
|
||||
"kind": "user_text",
|
||||
"content": "换个头",
|
||||
"clarity": "clear",
|
||||
"region": []
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
{
|
||||
"term": "人形机器人",
|
||||
"source": "explicit",
|
||||
"reason": "用户明确请求生成具有类人形态的机器人",
|
||||
"negated": false,
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
}
|
||||
],
|
||||
"robotTypes": [
|
||||
{
|
||||
"type": "biped",
|
||||
"source": "inferred",
|
||||
"reason": "类人人形机器人形态对应目录中的双足机器人模板",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
}
|
||||
],
|
||||
"partCategories": [
|
||||
{
|
||||
"category": "TORSO_0",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人基础构成部件,为整机躯干",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "HEAD_0",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人基础构成部件,本轮用户要求更换该部件",
|
||||
"evidenceIds": [
|
||||
"obs-001",
|
||||
"obs-002"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "WAIST_0",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人基础构成部件,为连接躯干的腰部结构",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "ARM_L",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置左臂部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "ARM_R",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置右臂部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "HAND_L",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置左手部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "HAND_R",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置右手部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "LEG_L",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置左足部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "LEG_R",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置右足部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "FOOT_L",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置左脚部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "FOOT_R",
|
||||
"source": "inferred",
|
||||
"reason": "双足人形机器人默认配置右脚部件",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
}
|
||||
],
|
||||
"excludedCategories": [],
|
||||
"constraints": [],
|
||||
"unmodeled": [
|
||||
{
|
||||
"text": "未明确指定人形机器人的具体自由度、运动性能、载荷、尺寸、材料、外观细节、应用场景及执行任务等参数",
|
||||
"reason": "用户仅提出人形整机形态要求,未提供可对应到目录组件的具体可投影约束信息",
|
||||
"evidenceIds": [
|
||||
"obs-001"
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "未明确指定更换后头部组件的具体形态、自由度、尺寸、材料、功能等参数",
|
||||
"reason": "用户仅提出更换头部的操作要求,未提供新头部部件的具体可投影约束信息",
|
||||
"evidenceIds": [
|
||||
"obs-002"
|
||||
]
|
||||
}
|
||||
],
|
||||
"questions": [],
|
||||
"operation": {
|
||||
"type": "replace",
|
||||
"targets": [
|
||||
{
|
||||
"family": "HEAD",
|
||||
"side": "0",
|
||||
"instanceId": "",
|
||||
"ordinal": "",
|
||||
"evidenceIds": [
|
||||
"obs-002"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user