aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/lib/Controller/AISettingsController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/lib/Controller/AISettingsController.php')
-rw-r--r--apps/settings/lib/Controller/AISettingsController.php36
1 files changed, 9 insertions, 27 deletions
diff --git a/apps/settings/lib/Controller/AISettingsController.php b/apps/settings/lib/Controller/AISettingsController.php
index 2676bfcf7e6..114cbf61514 100644
--- a/apps/settings/lib/Controller/AISettingsController.php
+++ b/apps/settings/lib/Controller/AISettingsController.php
@@ -3,41 +3,24 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2023 Marcel Klehr <mklehr@gmx.net>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Settings\Controller;
+use OCA\Settings\Settings\Admin\ArtificialIntelligence;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
use OCP\AppFramework\Http\DataResponse;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\IRequest;
class AISettingsController extends Controller {
- /**
- * @param string $appName
- * @param IRequest $request
- * @param IConfig $config
- */
public function __construct(
$appName,
IRequest $request,
- private IConfig $config,
+ private IAppConfig $appConfig,
) {
parent::__construct($appName, $request);
}
@@ -45,18 +28,17 @@ class AISettingsController extends Controller {
/**
* Sets the email settings
*
- * @AuthorizedAdminSetting(settings=OCA\Settings\Settings\Admin\ArtificialIntelligence)
- *
* @param array $settings
* @return DataResponse
*/
+ #[AuthorizedAdminSetting(settings: ArtificialIntelligence::class)]
public function update($settings) {
- $keys = ['ai.stt_provider', 'ai.textprocessing_provider_preferences', 'ai.translation_provider_preferences', 'ai.text2image_provider'];
+ $keys = ['ai.stt_provider', 'ai.textprocessing_provider_preferences', 'ai.taskprocessing_provider_preferences','ai.taskprocessing_type_preferences', 'ai.translation_provider_preferences', 'ai.text2image_provider', 'ai.taskprocessing_guests'];
foreach ($keys as $key) {
if (!isset($settings[$key])) {
continue;
}
- $this->config->setAppValue('core', $key, json_encode($settings[$key]));
+ $this->appConfig->setValueString('core', $key, json_encode($settings[$key]), lazy: in_array($key, \OC\TaskProcessing\Manager::LAZY_CONFIG_KEYS, true));
}
return new DataResponse();