diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-07-24 12:12:06 +0200 |
---|---|---|
committer | Julien Veyssier <julien-nc@posteo.net> | 2023-08-02 12:37:35 +0200 |
commit | fc9780a41d586e2983f18e128a4095484e5860ac (patch) | |
tree | 800ec46cda50a9e758f6b41f759423a7b82bb0a9 /apps/settings/src | |
parent | 78856f354f63d3c23920fc3eeb386d6e92d6215d (diff) | |
download | nextcloud-server-fc9780a41d586e2983f18e128a4095484e5860ac.tar.gz nextcloud-server-fc9780a41d586e2983f18e128a4095484e5860ac.zip |
First pass at ai admin settings
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/AdminAI.vue | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue new file mode 100644 index 00000000000..2e1104a49d2 --- /dev/null +++ b/apps/settings/src/components/AdminAI.vue @@ -0,0 +1,83 @@ +<template> + <NcSettingsSection :title="t('settings', 'Artificial Intelligence')" + :description="t('settings', 'Artificial Intelligence features can be implemented by different apps. Here you can set which app should be used for which features.')"> + <h3>{{ t('settings', 'Translations') }}</h3> + <h3>{{ t('settings', 'Speech-To-Text') }}</h3> + <template v-for="provider in sttProviders"> + <NcCheckboxRadioSwitch :key="provider.class" + :checked.sync="settings['ai.stt_provider']" + :value="provider.class" + name="stt_provider" + type="radio">{{ provider.name }}</NcCheckboxRadioSwitch> + </template> + <template v-if="sttProviders.length === 0"> + <NcCheckboxRadioSwitch disabled type="radio">{{ t('settings', 'No apps are currently installed that provide Speech-To-Text functionality') }}</NcCheckboxRadioSwitch> + </template> + <h3>{{ t('settings', 'Text processing') }}</h3> + <template v-for="(type, provider) in settings['ai.textprocessing_provider_preferences']"> + <h4>{{ type }}</h4> + <!--<p>{{ getTaskType(type).description }}</p> + <NcSelect v-model="settings['ai.textprocessing_provider_preferences'][type]" :options="textProcessingProviders.filter(provider => provider.taskType === type)" />--> + </template> + <template v-if="Object.keys(settings['ai.textprocessing_provider_preferences']).length === 0 || !Array.isArray(this.textProcessingTaskTypes)"> + <p>{{ t('settings', 'No apps are currently installed that provide Text processing functionality') }}</p> + </template> + </NcSettingsSection> +</template> + +<script> +import axios from '@nextcloud/axios' +import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' +import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js' +import { loadState } from '@nextcloud/initial-state' + +import { generateUrl } from '@nextcloud/router' + +export default { + name: 'AdminAI', + components: { + NcCheckboxRadioSwitch, + NcSettingsSection, + }, + data() { + return { + loading: false, + dirty: false, + groups: [], + loadingGroups: false, + sttProviders: loadState('settings', 'ai-stt-providers'), + translationProviders: loadState('settings', 'ai-translation-providers'), + textProcessingProviders: loadState('settings', 'ai-text-processing-providers'), + textProcessingTaskTypes: loadState('settings', 'ai-text-processing-task-types'), + settings: loadState('settings', 'ai-settings'), + } + }, + methods: { + saveChanges() { + this.loading = true + + const data = { + enforced: this.enforced, + enforcedGroups: this.enforcedGroups, + excludedGroups: this.excludedGroups, + } + axios.put(generateUrl('/settings/api/admin/twofactorauth'), data) + .then(resp => resp.data) + .then(state => { + this.state = state + this.dirty = false + }) + .catch(err => { + console.error('could not save changes', err) + }) + .then(() => { this.loading = false }) + }, + getTaskType(type) { + if (!Array.isArray(this.textProcessingTaskTypes)) { + return null + } + return this.textProcessingTaskTypes.find(taskType => taskType === type) + } + }, +} +</script> |