Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 103 additions & 68 deletions apps/settings/src/components/AdminAI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<template v-for="type in taskProcessingTaskTypes">
<div :key="type" class="tasktype-item">
<p class="tasktype-name">
{{ type.name }}
{{ getTaskTypeName(type) }}
</p>
<NcCheckboxRadioSwitch
v-model="settings['ai.taskprocessing_type_preferences'][type.id]"
Expand Down Expand Up @@ -46,76 +46,94 @@
</NcNoteCard>
</template>
</NcSettingsSection>
<NcSettingsSection
:name="t('settings', 'Machine translation')"
:description="t('settings', 'Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.')">
<VueDraggable v-model="settings['ai.translation_provider_preferences']" @change="saveChanges">
<div v-for="(providerClass, i) in settings['ai.translation_provider_preferences']" :key="providerClass" class="draggable__item">
<DragVerticalIcon /> <span class="draggable__number">{{ i + 1 }}</span> {{ translationProviders.find(p => p.class === providerClass)?.name }}
<NcButton aria-label="Move up" variant="tertiary" @click="moveUp(i)">
<template #icon>
<ArrowUpIcon />
</template>
</NcButton>
<NcButton aria-label="Move down" variant="tertiary" @click="moveDown(i)">
<template #icon>
<ArrowDownIcon />
</template>
</NcButton>
</div>
</VueDraggable>
</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.id"
v-model="settings['ai.text2image_provider']"
:value="provider.id"
name="text2image_provider"
type="radio"
@update:modelValue="saveChanges">
{{ provider.name }}
</NcCheckboxRadioSwitch>
<NcButton class="legacy-toggle" variant="tertiary" @click="showLegacySections = !showLegacySections">
<template #icon>
<ChevronUpIcon v-if="showLegacySections" />
<ChevronDownIcon v-else />
</template>
<template v-if="!hasText2ImageProviders">
<NcNoteCard type="info">
{{ t('settings', 'None of your currently installed apps provide image generation functionality') }}
{{ showLegacySections ? t('settings', 'Hide legacy provider settings') : t('settings', 'Show legacy provider settings') }}
</NcButton>
<div v-show="showLegacySections">
<NcSettingsSection
:name="t('settings', 'Machine translation (Legacy)')"
:description="t('settings', 'Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.')">
<NcNoteCard type="warning">
{{ t('settings', 'This API is deprecated. Install apps that provide Unified task processing to get the best experience.') }}
</NcNoteCard>
</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">
<div :key="type">
<h3>{{ t('settings', 'Task:') }} {{ getTextProcessingTaskType(type).name }}</h3>
<p>{{ getTextProcessingTaskType(type).description }}</p>
<p>&nbsp;</p>
<NcSelect
v-model="settings['ai.textprocessing_provider_preferences'][type]"
class="provider-select"
:clearable="false"
:options="textProcessingProviders.filter(p => p.taskType === type).map(p => p.class)"
@input="saveChanges">
<template #option="{ label }">
{{ textProcessingProviders.find(p => p.class === label)?.name }}
</template>
<template #selected-option="{ label }">
{{ textProcessingProviders.find(p => p.class === label)?.name }}
</template>
</NcSelect>
<p>&nbsp;</p>
</div>
</template>
<template v-if="tpTaskTypes.length === 0">
<NcNoteCard type="info">
<!-- TRANSLATORS Text processing is the name of a Nextcloud-internal API -->
{{ t('settings', 'None of your currently installed apps provide text processing functionality using the Text Processing API.') }}
<VueDraggable v-model="settings['ai.translation_provider_preferences']" @change="saveChanges">
<div v-for="(providerClass, i) in settings['ai.translation_provider_preferences']" :key="providerClass" class="draggable__item">
<DragVerticalIcon /> <span class="draggable__number">{{ i + 1 }}</span> {{ translationProviders.find(p => p.class === providerClass)?.name }}
<NcButton aria-label="Move up" variant="tertiary" @click="moveUp(i)">
<template #icon>
<ArrowUpIcon />
</template>
</NcButton>
<NcButton aria-label="Move down" variant="tertiary" @click="moveDown(i)">
<template #icon>
<ArrowDownIcon />
</template>
</NcButton>
</div>
</VueDraggable>
</NcSettingsSection>
<NcSettingsSection
:name="t('settings', 'Image generation (Legacy)')"
:description="t('settings', 'Image generation can be implemented by different apps. Here you can set which app should be used.')">
<NcNoteCard type="warning">
{{ t('settings', 'This API is deprecated. Install apps that provide Unified task processing to get the best experience.') }}
</NcNoteCard>
</template>
</NcSettingsSection>
<template v-for="provider in text2imageProviders">
<NcCheckboxRadioSwitch
:key="provider.id"
v-model="settings['ai.text2image_provider']"
:value="provider.id"
name="text2image_provider"
type="radio"
@update:modelValue="saveChanges">
{{ provider.name }}
</NcCheckboxRadioSwitch>
</template>
<template v-if="!hasText2ImageProviders">
<NcNoteCard type="info">
{{ t('settings', 'None of your currently installed apps provide image generation functionality') }}
</NcNoteCard>
</template>
</NcSettingsSection>
<NcSettingsSection
:name="t('settings', 'Text processing (Legacy)')"
:description="t('settings', 'Text processing tasks can be implemented by different apps. Here you can set which app should be used for which task.')">
<NcNoteCard type="warning">
{{ t('settings', 'This API is deprecated. Install apps that provide Unified task processing to get the best experience.') }}
</NcNoteCard>
<template v-for="type in tpTaskTypes">
<div :key="type">
<h3>{{ t('settings', 'Task:') }} {{ getTextProcessingTaskType(type).name }}</h3>
<p>{{ getTextProcessingTaskType(type).description }}</p>
<p>&nbsp;</p>
<NcSelect
v-model="settings['ai.textprocessing_provider_preferences'][type]"
class="provider-select"
:clearable="false"
:options="textProcessingProviders.filter(p => p.taskType === type).map(p => p.class)"
@input="saveChanges">
<template #option="{ label }">
{{ textProcessingProviders.find(p => p.class === label)?.name }}
</template>
<template #selected-option="{ label }">
{{ textProcessingProviders.find(p => p.class === label)?.name }}
</template>
</NcSelect>
<p>&nbsp;</p>
</div>
</template>
<template v-if="tpTaskTypes.length === 0">
<NcNoteCard type="info">
<!-- TRANSLATORS Text processing is the name of a Nextcloud-internal API -->
{{ t('settings', 'None of your currently installed apps provide text processing functionality using the Text Processing API.') }}
</NcNoteCard>
</template>
</NcSettingsSection>
</div>
</div>
</template>

Expand All @@ -132,6 +150,8 @@ import NcSelect from '@nextcloud/vue/components/NcSelect'
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
import ArrowDownIcon from 'vue-material-design-icons/ArrowDown.vue'
import ArrowUpIcon from 'vue-material-design-icons/ArrowUp.vue'
import ChevronDownIcon from 'vue-material-design-icons/ChevronDown.vue'
import ChevronUpIcon from 'vue-material-design-icons/ChevronUp.vue'
import DragVerticalIcon from 'vue-material-design-icons/DragVertical.vue'
import logger from '../logger.ts'

Expand All @@ -142,6 +162,8 @@ export default {
NcSettingsSection,
NcSelect,
VueDraggable,
ChevronDownIcon,
ChevronUpIcon,
DragVerticalIcon,
ArrowDownIcon,
ArrowUpIcon,
Expand All @@ -153,6 +175,7 @@ export default {
return {
loading: false,
dirty: false,
showLegacySections: false,
groups: [],
loadingGroups: false,
sttProviders: loadState('settings', 'ai-stt-providers'),
Expand Down Expand Up @@ -223,6 +246,13 @@ export default {
this.loading = false
},

getTaskTypeName(type) {
if (type.id === 'core:text2text') {
return t('settings', 'Generate text')
}
return type.name
},

getTextProcessingTaskType(type) {
if (!Array.isArray(this.textProcessingTaskTypes)) {
return null
Expand Down Expand Up @@ -265,6 +295,11 @@ export default {
min-width: 350px !important;
}

.legacy-toggle {
margin-top: 12px;
margin-bottom: 12px;
}

.tasktype-item {
display: flex;
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-admin-ai.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-admin-ai.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-personal-info.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-personal-info.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/updatenotification-updatenotification.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/updatenotification-updatenotification.js.map

Large diffs are not rendered by default.