Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(settings/AdminAI): Only show legacy AI APIs if necessary #47194

Closed
wants to merge 2 commits into from
Closed
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
30 changes: 11 additions & 19 deletions apps/settings/src/components/AdminAI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
</NcNoteCard>
</template>
</NcSettingsSection>
<NcSettingsSection :name="t('settings', 'Machine translation')"
<NcSettingsSection v-if="hasTranslate"
:name="t('settings', 'Legacy 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.')">
<draggable 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">
Expand All @@ -50,7 +51,8 @@
</div>
</draggable>
</NcSettingsSection>
<NcSettingsSection :name="t('settings', 'Speech-To-Text')"
<NcSettingsSection v-if="hasStt"
:name="t('settings', 'Legacy Speech-To-Text')"
:description="t('settings', 'Speech-To-Text can be implemented by different apps. Here you can set which app should be used.')">
<template v-for="provider in sttProviders">
<NcCheckboxRadioSwitch :key="provider.class"
Expand All @@ -62,13 +64,9 @@
{{ provider.name }}
</NcCheckboxRadioSwitch>
</template>
<template v-if="!hasStt">
<NcNoteCard type="info">
{{ t('settings', 'None of your currently installed apps provide Speech-To-Text functionality') }}
</NcNoteCard>
</template>
</NcSettingsSection>
<NcSettingsSection :name="t('settings', 'Image generation')"
<NcSettingsSection v-if="hasText2ImageProviders"
:name="t('settings', 'Legacy 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"
Expand All @@ -80,13 +78,9 @@
{{ 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')"
<NcSettingsSection v-if="hasTextProcessing"
: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">
Expand All @@ -108,11 +102,6 @@
<p>&nbsp;</p>
</div>
</template>
<template v-if="!hasTextProcessing">
<NcNoteCard type="info">
{{ t('settings', 'None of your currently installed apps provide Text processing functionality') }}
</NcNoteCard>
</template>
</NcSettingsSection>
</div>
</template>
Expand Down Expand Up @@ -165,6 +154,9 @@ export default {
hasStt() {
return this.sttProviders.length > 0
},
hasTranslate() {
return this.settings['ai.translation_provider_preferences'].length > 0
},
hasTextProcessing() {
return Object.keys(this.settings['ai.textprocessing_provider_preferences']).length > 0 && Array.isArray(this.textProcessingTaskTypes)
},
Expand Down
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.