fix: recursively unwrap remote prompt wrappers
This commit is contained in:
@@ -1185,19 +1185,19 @@ def _extract_prompt_executor_error(executor: Any) -> str:
|
||||
|
||||
def _normalize_link_output_index(value: Any) -> Any:
|
||||
"""Unwrap a singleton list around a prompt-link output index when present."""
|
||||
if isinstance(value, list) and len(value) == 1 and isinstance(value[0], int | float):
|
||||
return value[0]
|
||||
while isinstance(value, list) and len(value) == 1:
|
||||
value = value[0]
|
||||
return value
|
||||
|
||||
|
||||
def _normalize_prompt_input_value(value: Any) -> Any:
|
||||
"""Unwrap transport-added singleton lists around scalar prompt input values."""
|
||||
while isinstance(value, list) and len(value) == 1:
|
||||
value = value[0]
|
||||
if isinstance(value, list) and len(value) == 2 and isinstance(value[0], str):
|
||||
return [value[0], _normalize_link_output_index(value[1])]
|
||||
if isinstance(value, list) and len(value) == 1:
|
||||
candidate = value[0]
|
||||
if candidate is None or isinstance(candidate, bool | int | float | str):
|
||||
return candidate
|
||||
if value is None or isinstance(value, bool | int | float | str):
|
||||
return value
|
||||
return value
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -266,19 +266,19 @@ def _is_link(value: Any) -> bool:
|
||||
|
||||
def _normalize_link_output_index(value: Any) -> Any:
|
||||
"""Unwrap a singleton list around a prompt-link output index when present."""
|
||||
if isinstance(value, list) and len(value) == 1 and isinstance(value[0], int | float):
|
||||
return value[0]
|
||||
while isinstance(value, list) and len(value) == 1:
|
||||
value = value[0]
|
||||
return value
|
||||
|
||||
|
||||
def _normalize_prompt_input_value(value: Any) -> Any:
|
||||
"""Unwrap transport-added singleton lists around scalar prompt input values."""
|
||||
while isinstance(value, list) and len(value) == 1:
|
||||
value = value[0]
|
||||
if isinstance(value, list) and len(value) == 2 and isinstance(value[0], str):
|
||||
return [value[0], _normalize_link_output_index(value[1])]
|
||||
if isinstance(value, list) and len(value) == 1:
|
||||
candidate = value[0]
|
||||
if candidate is None or isinstance(candidate, bool | int | float | str):
|
||||
return candidate
|
||||
if value is None or isinstance(value, bool | int | float | str):
|
||||
return value
|
||||
return value
|
||||
|
||||
|
||||
|
||||
@@ -2498,7 +2498,7 @@ def test_local_remote_app_normalizes_wrapped_subgraph_link_indexes(
|
||||
},
|
||||
"remote_2": {
|
||||
"class_type": "BoundarySink",
|
||||
"inputs": {"value": ["remote_1", [0]]},
|
||||
"inputs": {"value": [[["remote_1", [0]]]]},
|
||||
"_meta": {},
|
||||
},
|
||||
},
|
||||
@@ -2512,7 +2512,7 @@ def test_local_remote_app_normalizes_wrapped_subgraph_link_indexes(
|
||||
{
|
||||
"proxy_output_name": "remote_2_value",
|
||||
"node_id": "remote_2",
|
||||
"output_index": [0],
|
||||
"output_index": [[0]],
|
||||
"io_type": "INT",
|
||||
"is_list": False,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user