aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-10-23 16:40:34 +0200
committerJulien Veyssier <julien-nc@posteo.net>2024-10-24 11:28:16 +0200
commit54cebc213695ca07e7fdd830d2ba99e8526991b3 (patch)
tree28d8661066a09a9c606f35d6749e37ecb7f91444
parentf1684ff77ed063700dd94fe61d3b1176adf4867e (diff)
downloadnextcloud-server-54cebc213695ca07e7fdd830d2ba99e8526991b3.tar.gz
nextcloud-server-54cebc213695ca07e7fdd830d2ba99e8526991b3.zip
fix(textprocessing): also list types that are available in task processing
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
-rw-r--r--lib/private/TextProcessing/Manager.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php
index 8d34b5fba01..db759cf224c 100644
--- a/lib/private/TextProcessing/Manager.php
+++ b/lib/private/TextProcessing/Manager.php
@@ -82,6 +82,20 @@ class Manager implements IManager {
}
public function hasProviders(): bool {
+ // check if task processing equivalent types are available
+ $taskTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
+ $taskProcessingCompatibleTaskTypes = [
+ FreePromptTaskType::class => TextToText::ID,
+ HeadlineTaskType::class => TextToTextHeadline::ID,
+ SummaryTaskType::class => TextToTextSummary::ID,
+ TopicsTaskType::class => TextToTextTopics::ID,
+ ];
+ foreach ($taskProcessingCompatibleTaskTypes as $textTaskTypeClass => $taskTaskTypeId) {
+ if (isset($taskTaskTypes[$taskTaskTypeId])) {
+ return true;
+ }
+ }
+
$context = $this->coordinator->getRegistrationContext();
if ($context === null) {
return false;
@@ -97,6 +111,21 @@ class Manager implements IManager {
foreach ($this->getProviders() as $provider) {
$tasks[$provider->getTaskType()] = true;
}
+
+ // check if task processing equivalent types are available
+ $taskTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
+ $taskProcessingCompatibleTaskTypes = [
+ FreePromptTaskType::class => TextToText::ID,
+ HeadlineTaskType::class => TextToTextHeadline::ID,
+ SummaryTaskType::class => TextToTextSummary::ID,
+ TopicsTaskType::class => TextToTextTopics::ID,
+ ];
+ foreach ($taskProcessingCompatibleTaskTypes as $textTaskTypeClass => $taskTaskTypeId) {
+ if (isset($taskTaskTypes[$taskTaskTypeId])) {
+ $tasks[$textTaskTypeClass] = true;
+ }
+ }
+
return array_keys($tasks);
}