move setting of userId before provider execution

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
pull/42761/head
Andrey Borysenko 5 months ago
parent 13588c7566
commit ea7f1f9ecd
No known key found for this signature in database
GPG Key ID: 934CB29F9F59B0D1

@ -126,9 +126,6 @@ class SpeechToTextManager implements ISpeechToTextManager {
if ($provider instanceof ISpeechToTextProviderWithId) {
return $provider->getId() === $classNameOrId;
}
if ($provider instanceof ISpeechToTextProviderWithUserId) {
$provider->setUserId($this->userSession->getUser()?->getUID());
}
return $provider::class === $classNameOrId;
}));
if ($provider !== false) {
@ -138,6 +135,9 @@ class SpeechToTextManager implements ISpeechToTextManager {
foreach ($providers as $provider) {
try {
if ($provider instanceof ISpeechToTextProviderWithUserId) {
$provider->setUserId($this->userSession->getUser()?->getUID());
}
return $provider->transcribeFile($file);
} catch (\Throwable $e) {
$this->logger->info('SpeechToText transcription using provider ' . $provider->getName() . ' failed', ['exception' => $e]);

Loading…
Cancel
Save