Skip to content

Commit

Permalink
feat(settings/admin/ai): fix provider list not being declared
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Jul 17, 2024
1 parent d37dd4b commit 183726a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/TaskProcessing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ public function getProviders(): array {
public function getPreferredProvider(string $taskType) {
try {
$preferences = json_decode($this->config->getAppValue('core', 'ai.taskprocessing_provider_preferences', 'null'), associative: true, flags: JSON_THROW_ON_ERROR);
$providers = $this->getProviders();
if (isset($preferences[$taskType])) {
$providers = $this->getProviders();
$provider = current(array_values(array_filter($providers, fn ($provider) => $provider->getId() === $preferences[$taskType])));
if ($provider !== false) {
return $provider;
Expand Down

0 comments on commit 183726a

Please sign in to comment.