|
61 | 61 | @click="onChangeBackupPath" /> |
62 | 62 | </NcAppSettingsSection> |
63 | 63 |
|
| 64 | + <NcAppSettingsSection v-if="contextChatInstalled || isAdmin && appStoreEnabled" id="contextchat" :name="t('bookmarks', 'Context Chat integration')"> |
| 65 | + <template #icon> |
| 66 | + <ContextChatIcon :size="20" /> |
| 67 | + </template> |
| 68 | + <p>{{ t('bookmarks', 'The bookmarks app can automatically make available the textual contents of the websites you bookmark to Context Chat, which allows asking questions about and getting answers based on those contents. This is only available if auto-archiving is enabled.') }}</p> |
| 69 | + <p v-if="isAdmin && !contextChatInstalled"> |
| 70 | + {{ t('bookmarks', 'Context chat is currently not installed, but is required for this feature.') }} |
| 71 | + </p> |
| 72 | + <NcCheckboxRadioSwitch :checked="contextChatEnabled" :disabled="!archiveEnabled" @update:checked="onChangeContextChatEnabled"> |
| 73 | + {{ t('bookmarks', 'Enable Context Chat integration') }} |
| 74 | + </NcCheckboxRadioSwitch> |
| 75 | + </NcAppSettingsSection> |
| 76 | + |
64 | 77 | <NcAppSettingsSection id="client-apps" :name="t('bookmarks', 'Client apps')"> |
65 | 78 | <template #icon> |
66 | 79 | <ApplicationIcon :size="20" /> |
|
124 | 137 | <script> |
125 | 138 | import { generateUrl } from '@nextcloud/router' |
126 | 139 | import { actions } from '../store/index.js' |
127 | | -import { getRequestToken } from '@nextcloud/auth' |
| 140 | +import { getRequestToken, getCurrentUser } from '@nextcloud/auth' |
128 | 141 | import { getFilePickerBuilder } from '@nextcloud/dialogs' |
129 | 142 | import { privateRoutes } from '../router.js' |
130 | 143 | import { NcAppSettingsSection, NcAppSettingsDialog, NcCheckboxRadioSwitch, NcTextField } from '@nextcloud/vue' |
131 | | -import { ImportIcon, ArchiveIcon, BackupIcon, LinkIcon, ApplicationIcon, ApplicationImportIcon } from './Icons.js' |
| 144 | +import { ImportIcon, ArchiveIcon, BackupIcon, LinkIcon, ApplicationIcon, ApplicationImportIcon, ContextChatIcon } from './Icons.js' |
132 | 145 | import HeartIcon from 'vue-material-design-icons/Heart.vue' |
133 | 146 | import LifebuoyIcon from 'vue-material-design-icons/Lifebuoy.vue' |
| 147 | +import { loadState } from '@nextcloud/initial-state' |
134 | 148 |
|
135 | 149 | export default { |
136 | 150 | name: 'Settings', |
137 | | - components: { LifebuoyIcon, HeartIcon, NcAppSettingsSection, NcAppSettingsDialog, NcCheckboxRadioSwitch, NcTextField, ImportIcon, ArchiveIcon, BackupIcon, LinkIcon, ApplicationIcon, ApplicationImportIcon }, |
| 151 | + components: { ContextChatIcon, LifebuoyIcon, HeartIcon, NcAppSettingsSection, NcAppSettingsDialog, NcCheckboxRadioSwitch, NcTextField, ImportIcon, ArchiveIcon, BackupIcon, LinkIcon, ApplicationIcon, ApplicationImportIcon }, |
138 | 152 | props: { |
139 | 153 | settingsOpen: { |
140 | 154 | type: Boolean, |
@@ -186,6 +200,18 @@ export default { |
186 | 200 | backupEnabled() { |
187 | 201 | return this.$store.state.settings['backup.enabled'] === 'true' |
188 | 202 | }, |
| 203 | + contextChatEnabled() { |
| 204 | + return this.$store.state.settings['contextchat.enabled'] === 'true' |
| 205 | + }, |
| 206 | + contextChatInstalled() { |
| 207 | + return loadState('bookmarks', 'contextChatInstalled') |
| 208 | + }, |
| 209 | + isAdmin() { |
| 210 | + return getCurrentUser()?.isAdmin |
| 211 | + }, |
| 212 | + appStoreEnabled() { |
| 213 | + return loadState('bookmarks', 'appStoreEnabled') |
| 214 | + }, |
189 | 215 | }, |
190 | 216 | mounted() { |
191 | 217 | window.addEventListener('beforeinstallprompt', (e) => { |
@@ -219,6 +245,12 @@ export default { |
219 | 245 | value: String(!this.archiveEnabled), |
220 | 246 | }) |
221 | 247 | }, |
| 248 | + async onChangeContextChatEnabled(e) { |
| 249 | + await this.$store.dispatch(actions.SET_SETTING, { |
| 250 | + key: 'contextchat.enabled', |
| 251 | + value: String(!this.contextChatEnabled), |
| 252 | + }) |
| 253 | + }, |
222 | 254 | async onChangeArchivePath(e) { |
223 | 255 | const path = await this.archivePathPicker.pick() |
224 | 256 | await this.$store.dispatch(actions.SET_SETTING, { |
|
0 commit comments