From 8f02796a62c99031b6c89687841be1212f8eea12 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 13 Nov 2024 16:59:46 +0100 Subject: [PATCH] fix(textprocessing): accept scheduling a task if there are equivalent taskprocessing providers only Signed-off-by: Julien Veyssier --- lib/private/TextProcessing/Manager.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php index 17778d310915e..63157d3164a0c 100644 --- a/lib/private/TextProcessing/Manager.php +++ b/lib/private/TextProcessing/Manager.php @@ -221,7 +221,11 @@ public function scheduleTask(OCPTask $task): void { } $task->setStatus(OCPTask::STATUS_SCHEDULED); $providers = $this->getPreferredProviders($task); - if (count($providers) === 0) { + $equivalentTaskProcessingTypeAvailable = ( + isset(self::$taskProcessingCompatibleTaskTypes[$task->getType()]) + && isset($this->taskProcessingManager->getAvailableTaskTypes()[self::$taskProcessingCompatibleTaskTypes[$task->getType()]]) + ); + if (count($providers) === 0 && !$equivalentTaskProcessingTypeAvailable) { throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task'); } [$provider,] = $providers;