diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/Controller/AISettingsController.php | 2 | ||||
-rw-r--r-- | apps/settings/lib/Settings/Admin/ArtificialIntelligence.php | 4 | ||||
-rw-r--r-- | apps/settings/src/components/AdminAI.vue | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/apps/settings/lib/Controller/AISettingsController.php b/apps/settings/lib/Controller/AISettingsController.php index 0586c652702..e08ec616e80 100644 --- a/apps/settings/lib/Controller/AISettingsController.php +++ b/apps/settings/lib/Controller/AISettingsController.php @@ -38,7 +38,7 @@ class AISettingsController extends Controller { */ #[AuthorizedAdminSetting(settings: ArtificialIntelligence::class)] public function update($settings) { - $keys = ['ai.stt_provider', 'ai.textprocessing_provider_preferences', 'ai.taskprocessing_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']; 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 4092acecab8..197ea0de283 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -113,12 +113,14 @@ class ArtificialIntelligence implements IDelegatedSettings { } } $taskProcessingTaskTypes = []; + $taskProcessingTypeSettings = []; foreach ($this->taskProcessingManager->getAvailableTaskTypes() as $taskTypeId => $taskTypeDefinition) { $taskProcessingTaskTypes[] = [ 'id' => $taskTypeId, 'name' => $taskTypeDefinition['name'], 'description' => $taskTypeDefinition['description'], ]; + $taskProcessingTypeSettings[$taskTypeId] = true; } $this->initialState->provideInitialState('ai-stt-providers', $sttProviders); @@ -135,6 +137,7 @@ class ArtificialIntelligence implements IDelegatedSettings { 'ai.textprocessing_provider_preferences' => $textProcessingSettings, 'ai.text2image_provider' => count($text2imageProviders) > 0 ? $text2imageProviders[0]['id'] : null, 'ai.taskprocessing_provider_preferences' => $taskProcessingSettings, + 'ai.taskprocessing_type_preferences' => $taskProcessingTypeSettings, ]; foreach ($settings as $key => $defaultValue) { $value = $defaultValue; @@ -143,6 +146,7 @@ class ArtificialIntelligence implements IDelegatedSettings { $value = json_decode($json, true); switch ($key) { case 'ai.taskprocessing_provider_preferences': + case 'ai.taskprocessing_type_preferences': case 'ai.textprocessing_provider_preferences': // fill $value with $defaultValue values $value = array_merge($defaultValue, $value); diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue index df53d88c85e..0d6f32a9aa9 100644 --- a/apps/settings/src/components/AdminAI.vue +++ b/apps/settings/src/components/AdminAI.vue @@ -11,13 +11,14 @@ <h3>{{ t('settings', 'Task:') }} {{ type.name }}</h3> <p>{{ type.description }}</p> <NcCheckboxRadioSwitch type="switch" - v-model="taskEnabled" > + v-model="settings['ai.taskprocessing_type_preferences'][type.id]" + @update:modelValue="saveChanges" > {{ t('settings', 'Enable') }} </NcCheckboxRadioSwitch> <NcSelect v-model="settings['ai.taskprocessing_provider_preferences'][type.id]" class="provider-select" :clearable="false" - :disabled="!taskEnabled" + :disabled="!type.enabled" :options="taskProcessingProviders.filter(p => p.taskType === type.id).map(p => p.id)" @input="saveChanges"> <template #option="{label}"> @@ -146,7 +147,6 @@ export default { taskProcessingProviders: loadState('settings', 'ai-task-processing-providers'), taskProcessingTaskTypes: loadState('settings', 'ai-task-processing-task-types'), settings: loadState('settings', 'ai-settings'), - taskEnabled: true, } }, computed: { @@ -189,6 +189,7 @@ export default { this.saveChanges() }, async saveChanges() { + console.warn(this.settings) this.loading = true await nextTick() const data = { settings: this.settings } @@ -198,6 +199,7 @@ export default { console.error('could not save changes', err) } this.loading = false + console.warn('done') }, getTextProcessingTaskType(type) { if (!Array.isArray(this.textProcessingTaskTypes)) { |