From 338b301669fa47f07e4ef8c783060925787cd30e Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 3 Dec 2024 12:54:19 +0100 Subject: [PATCH] fix(TaskProcessingService): TaskProcessing tasktype i/o shapes were broken Signed-off-by: Marcel Klehr --- .../ProvidersAI/TaskProcessingService.php | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/Service/ProvidersAI/TaskProcessingService.php b/lib/Service/ProvidersAI/TaskProcessingService.php index 64bd1282..f08562de 100644 --- a/lib/Service/ProvidersAI/TaskProcessingService.php +++ b/lib/Service/ProvidersAI/TaskProcessingService.php @@ -381,19 +381,25 @@ public function getDescription(): string { } public function getInputShape(): array { - return array_map(static fn (array $shape) => new ShapeDescriptor( - $shape['name'], - $shape['description'], - EShapeType::from($shape['type']), - ), $this->customTaskType['input_shape']); + return array_reduce($this->customTaskType['input_shape'], static function (array $input, array $shape) { + $input[$shape['name']] = new ShapeDescriptor( + $shape['name'], + $shape['description'], + EShapeType::from($shape['shape_type']), + ); + return $input; + }, []); } public function getOutputShape(): array { - return array_map(static fn (array $shape) => new ShapeDescriptor( - $shape['name'], - $shape['description'], - EShapeType::from($shape['type']), - ), $this->customTaskType['output_shape']); + return array_reduce($this->customTaskType['output_shape'], static function (array $output, array $shape) { + $output[$shape['name']] = new ShapeDescriptor( + $shape['name'], + $shape['description'], + EShapeType::from($shape['shape_type']), + ); + return $output; + }, []); } }; }