From e5856b303660f9155d431e0a1413e1450d1dc1e4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 16 Jul 2024 16:12:22 -0300 Subject: [PATCH] fix: append new tasks to the end of the list (#2737) fix: append new tasks to the end of the list --- .../base/langflow/components/helpers/SequentialTask.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/base/langflow/components/helpers/SequentialTask.py b/src/backend/base/langflow/components/helpers/SequentialTask.py index 5cf3f54e9..793d7db4c 100644 --- a/src/backend/base/langflow/components/helpers/SequentialTask.py +++ b/src/backend/base/langflow/components/helpers/SequentialTask.py @@ -54,7 +54,7 @@ class SequentialTaskComponent(Component): ] def build_task(self) -> list[SequentialTask]: - tasks = [] + tasks: list[SequentialTask] = [] task = SequentialTask( description=self.task_description, expected_output=self.expected_output, @@ -65,8 +65,8 @@ class SequentialTaskComponent(Component): tasks.append(task) self.status = task if self.task: - if isinstance(self.task, list): - tasks.extend(self.task) - else: - tasks.append(self.task) + if isinstance(self.task, list) and all(isinstance(task, SequentialTask) for task in self.task): + tasks = self.task + tasks + elif isinstance(self.task, SequentialTask): + tasks = [self.task] + tasks return tasks