aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Controller/AISettingsController.php2
-rw-r--r--apps/settings/lib/Settings/Admin/ArtificialIntelligence.php11
-rw-r--r--apps/settings/src/components/AdminAI.vue22
3 files changed, 34 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;
diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue
index 6a8b73d81f3..77755fdc0af 100644
--- a/apps/settings/src/components/AdminAI.vue
+++ b/apps/settings/src/components/AdminAI.vue
@@ -36,6 +36,24 @@
</NcCheckboxRadioSwitch>
</template>
</NcSettingsSection>
+ <NcSettingsSection :name="t('settings', 'Image generation')"
+ :description="t('settings', 'Image generation can be implemented by different apps. Here you can set which app should be used.')">
+ <template v-for="provider in text2imageProviders">
+ <NcCheckboxRadioSwitch :key="provider.class"
+ :checked.sync="settings['ai.text2image_provider']"
+ :value="provider.class"
+ name="text2image_provider"
+ type="radio"
+ @update:checked="saveChanges">
+ {{ provider.name }}
+ </NcCheckboxRadioSwitch>
+ </template>
+ <template v-if="!hasStt">
+ <NcCheckboxRadioSwitch disabled type="radio">
+ {{ t('settings', 'None of your currently installed apps provide image generation functionality') }}
+ </NcCheckboxRadioSwitch>
+ </template>
+ </NcSettingsSection>
<NcSettingsSection :name="t('settings', 'Text processing')"
:description="t('settings', 'Text processing tasks can be implemented by different apps. Here you can set which app should be used for which task.')">
<template v-for="type in tpTaskTypes">
@@ -100,6 +118,7 @@ export default {
translationProviders: loadState('settings', 'ai-translation-providers'),
textProcessingProviders: loadState('settings', 'ai-text-processing-providers'),
textProcessingTaskTypes: loadState('settings', 'ai-text-processing-task-types'),
+ text2imageProviders: loadState('settings', 'ai-text2image-providers'),
settings: loadState('settings', 'ai-settings'),
}
},
@@ -113,6 +132,9 @@ export default {
tpTaskTypes() {
return Object.keys(this.settings['ai.textprocessing_provider_preferences']).filter(type => !!this.getTaskType(type))
},
+ hasText2ImageProviders() {
+ return this.text2imageProviders.length > 0
+ }
},
methods: {
moveUp(i) {