Skip to content

Commit

Permalink
fix: Improve logic to consider target handle name in ComponentVertex.
Browse files Browse the repository at this point in the history
Fixes #3380
  • Loading branch information
ogabrielluiz committed Aug 16, 2024
1 parent 403648e commit 2848f6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/backend/base/langflow/graph/vertex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ async def _build_dict_and_update_params(
if not self._is_vertex(value):
self.params[key][sub_key] = value
else:
result = await value.get_result(self)
result = await value.get_result(self, target_handle_name=key)
self.params[key][sub_key] = result

def _is_vertex(self, value):
Expand Down Expand Up @@ -636,7 +636,7 @@ async def _build_list_of_vertices_and_update_params(
"""
self.params[key] = []
for vertex in vertices:
result = await vertex.get_result(self)
result = await vertex.get_result(self, target_handle_name=key)
# Weird check to see if the params[key] is a list
# because sometimes it is a Data and breaks the code
if not isinstance(self.params[key], list):
Expand Down
6 changes: 5 additions & 1 deletion src/backend/base/langflow/graph/vertex/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ async def _get_result(self, requester: "Vertex", target_handle_name: str | None
edges = self.get_edge_with_target(requester.id)
result = UNDEFINED
for edge in edges:
if edge is not None and edge.source_handle.name in self.results:
if (
edge is not None
and edge.source_handle.name in self.results
and edge.target_handle.field_name == target_handle_name
):
# Get the result from the output instead of the results dict
try:
output = self.get_output(edge.source_handle.name)
Expand Down

0 comments on commit 2848f6c

Please sign in to comment.