aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-12-19 16:14:13 +0100
committerGitHub <noreply@github.com>2023-12-19 16:14:13 +0100
commit53be798a70436b77a512a7ea5045b675280f43bc (patch)
treed5664cc59e2c2e6cbaf5acc6b5b8e4ec08aa8061 /lib/private
parente5622171b45639302c173e427c424963a0ff7b9f (diff)
parent9327e36ef4ad0b306d060c1bbaed1dc3ac4c73ed (diff)
downloadnextcloud-server-53be798a70436b77a512a7ea5045b675280f43bc.tar.gz
nextcloud-server-53be798a70436b77a512a7ea5045b675280f43bc.zip
Merge branch 'master' into enh/text-processing-provider-with-id
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/SpeechToText/SpeechToTextManager.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/SpeechToText/SpeechToTextManager.php b/lib/private/SpeechToText/SpeechToTextManager.php
index bdd04ad3651..520700cf198 100644
--- a/lib/private/SpeechToText/SpeechToTextManager.php
+++ b/lib/private/SpeechToText/SpeechToTextManager.php
@@ -39,6 +39,7 @@ use OCP\IServerContainer;
use OCP\PreConditionNotMetException;
use OCP\SpeechToText\ISpeechToTextManager;
use OCP\SpeechToText\ISpeechToTextProvider;
+use OCP\SpeechToText\ISpeechToTextProviderWithId;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;
@@ -117,8 +118,13 @@ class SpeechToTextManager implements ISpeechToTextManager {
$json = $this->config->getAppValue('core', 'ai.stt_provider', '');
if ($json !== '') {
- $className = json_decode($json, true);
- $provider = current(array_filter($providers, fn ($provider) => $provider::class === $className));
+ $classNameOrId = json_decode($json, true);
+ $provider = current(array_filter($providers, function ($provider) use ($classNameOrId) {
+ if ($provider instanceof ISpeechToTextProviderWithId) {
+ return $provider->getId() === $classNameOrId;
+ }
+ return $provider::class === $classNameOrId;
+ }));
if ($provider !== false) {
$providers = [$provider];
}