mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 16:22:49 +00:00
fix task cloning error (#1416)
This commit is contained in:
committed by
GitHub
parent
76c4f2a2b4
commit
02718e291b
@@ -900,7 +900,22 @@ class Crew(BaseModel):
|
||||
}
|
||||
|
||||
cloned_agents = [agent.copy() for agent in self.agents]
|
||||
cloned_tasks = [task.copy(cloned_agents) for task in self.tasks]
|
||||
|
||||
task_mapping = {}
|
||||
|
||||
cloned_tasks = []
|
||||
for task in self.tasks:
|
||||
cloned_task = task.copy(cloned_agents, task_mapping)
|
||||
cloned_tasks.append(cloned_task)
|
||||
task_mapping[task.key] = cloned_task
|
||||
|
||||
for cloned_task, original_task in zip(cloned_tasks, self.tasks):
|
||||
if original_task.context:
|
||||
cloned_context = [
|
||||
task_mapping[context_task.key]
|
||||
for context_task in original_task.context
|
||||
]
|
||||
cloned_task.context = cloned_context
|
||||
|
||||
copied_data = self.model_dump(exclude=exclude)
|
||||
copied_data = {k: v for k, v in copied_data.items() if v is not None}
|
||||
|
||||
Reference in New Issue
Block a user