diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-12-19 17:43:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 17:43:18 +0100 |
commit | c3d5b46f53ffd8ba98b5451ce3bb35c3dfa80290 (patch) | |
tree | 8ebac5244fb8046c32103967da59ce3fc39d230d /apps | |
parent | 94a5e6c7b37765a4e8079ad945801a0a892dba04 (diff) | |
parent | 53be798a70436b77a512a7ea5045b675280f43bc (diff) | |
download | nextcloud-server-c3d5b46f53ffd8ba98b5451ce3bb35c3dfa80290.tar.gz nextcloud-server-c3d5b46f53ffd8ba98b5451ce3bb35c3dfa80290.zip |
Merge pull request #41088 from nextcloud/enh/text-processing-provider-with-id
enh(TextProcessing): Allow providers and task types to declare a dynamic ID instead of using className
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/Settings/Admin/ArtificialIntelligence.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index 8a283ba1e70..e2862139e49 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -34,6 +34,7 @@ use OCP\SpeechToText\ISpeechToTextManager; use OCP\SpeechToText\ISpeechToTextProviderWithId; use OCP\TextProcessing\IManager; use OCP\TextProcessing\IProvider; +use OCP\TextProcessing\IProviderWithId; use OCP\TextProcessing\ITaskType; use OCP\Translation\ITranslationManager; use Psr\Container\ContainerExceptionInterface; @@ -76,15 +77,15 @@ class ArtificialIntelligence implements IDelegatedSettings { } $textProcessingProviders = []; - /** @var array<class-string<ITaskType>, class-string<IProvider>> $textProcessingSettings */ + /** @var array<class-string<ITaskType>, string|class-string<IProvider>> $textProcessingSettings */ $textProcessingSettings = []; foreach ($this->textProcessingManager->getProviders() as $provider) { $textProcessingProviders[] = [ - 'class' => $provider::class, + 'class' => $provider instanceof IProviderWithId ? $provider->getId() : $provider::class, 'name' => $provider->getName(), 'taskType' => $provider->getTaskType(), ]; - $textProcessingSettings[$provider->getTaskType()] = $provider::class; + $textProcessingSettings[$provider->getTaskType()] = $provider instanceof IProviderWithId ? $provider->getId() : $provider::class; } $textProcessingTaskTypes = []; foreach ($textProcessingSettings as $taskTypeClass => $providerClass) { |