aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-10-23 16:40:34 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-24 10:53:43 +0000
commit67437d03252a09268a8293758429011c3af6ee7c (patch)
tree3d6c00c0ccda52c404d43bf947e983fd62d444f3 /lib
parent433d484e80dfbb4b7acab9c738ba5fa8ad3814e4 (diff)
downloadnextcloud-server-67437d03252a09268a8293758429011c3af6ee7c.tar.gz
nextcloud-server-67437d03252a09268a8293758429011c3af6ee7c.zip
fix(textprocessing): also list types that are available in task processing
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'lib')
-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 81a8f59c955..617f57c6ba2 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);
}