diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-10-22 11:10:24 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-10-22 11:10:24 +0200 |
commit | 9787f9dba010f17bb53e88989716c94d677c0916 (patch) | |
tree | 7169560aee7c0504cba33a442cef6439ad621054 /apps/settings/lib | |
parent | cee5aa84f02de18084067a2e33e8d252f2362be4 (diff) | |
download | nextcloud-server-9787f9dba010f17bb53e88989716c94d677c0916.tar.gz nextcloud-server-9787f9dba010f17bb53e88989716c94d677c0916.zip |
enh(Text2Image): Add AI settings section to text2image
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'apps/settings/lib')
-rw-r--r-- | apps/settings/lib/Controller/AISettingsController.php | 2 | ||||
-rw-r--r-- | apps/settings/lib/Settings/Admin/ArtificialIntelligence.php | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/apps/settings/lib/Controller/AISettingsController.php b/apps/settings/lib/Controller/AISettingsController.php index 7f016d79c25..8db8fa8b5bb 100644 --- a/apps/settings/lib/Controller/AISettingsController.php +++ b/apps/settings/lib/Controller/AISettingsController.php @@ -57,7 +57,7 @@ class AISettingsController extends Controller { * @return DataResponse */ public function update($settings) { - $keys = ['ai.stt_provider', 'ai.textprocessing_provider_preferences', 'ai.translation_provider_preferences']; + $keys = ['ai.stt_provider', 'ai.textprocessing_provider_preferences', 'ai.translation_provider_preferences', 'ai.text2image_provider']; foreach ($keys as $key) { if (!isset($settings[$key])) { continue; diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index eb1983690a5..4556f8e0a9d 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -48,6 +48,7 @@ class ArtificialIntelligence implements IDelegatedSettings { private ISpeechToTextManager $sttManager, private IManager $textProcessingManager, private ContainerInterface $container, + private \OCP\TextToImage\IManager $text2imageManager, ) { } @@ -101,15 +102,25 @@ class ArtificialIntelligence implements IDelegatedSettings { ]; } + $text2imageProviders = []; + foreach ($this->text2imageManager->getProviders() as $provider) { + $text2imageProviders[] = [ + 'class' => $provider::class, + 'name' => $provider->getName(), + ]; + } + $this->initialState->provideInitialState('ai-stt-providers', $sttProviders); $this->initialState->provideInitialState('ai-translation-providers', $translationProviders); $this->initialState->provideInitialState('ai-text-processing-providers', $textProcessingProviders); $this->initialState->provideInitialState('ai-text-processing-task-types', $textProcessingTaskTypes); + $this->initialState->provideInitialState('ai-text2image-providers', $text2imageProviders); $settings = [ 'ai.stt_provider' => count($sttProviders) > 0 ? $sttProviders[0]['class'] : null, 'ai.textprocessing_provider_preferences' => $textProcessingSettings, 'ai.translation_provider_preferences' => $translationPreferences, + 'ai.text2image_provider' => count($text2imageProviders) > 0 ? $text2imageProviders[0]['class'] : null, ]; foreach ($settings as $key => $defaultValue) { $value = $defaultValue; |