Skip to content

Commit aa8c098

Browse files
committed
enh(contextChat): Add warning if indexing is not complete, yet
1 parent 687a475 commit aa8c098

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Listener/BeforeTemplateRenderedListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function handle(Event $event): void {
6161
if ($assistantEnabled) {
6262
$lastTargetLanguage = $this->config->getUserValue($this->userId, Application::APP_ID, 'last_target_language', '');
6363
$this->initialStateService->provideInitialState('last-target-language', $lastTargetLanguage);
64+
$indexingComplete = $this->appConfig->getValueInt('context_chat', 'last_indexed_time', 0) !== 0;
65+
$this->initialStateService->provideInitialState('contextChatIndexingComplete', $indexingComplete);
6466
}
6567
Util::addScript(Application::APP_ID, Application::APP_ID . '-main');
6668
}

src/components/ContextChat/ContextChatInputForm.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
-->
55
<template>
66
<div class="cc-input-form">
7+
<NcNoteCard v-if="!indexingComplete" type="warning">
8+
{{ t('assistant', 'Context Chat has not finished indexing all your documents yet, it may not be able to answer your questions, yet.') }}
9+
</NcNoteCard>
710
<TextInput
811
id="context_chat_input"
912
:value="inputs.prompt"
@@ -128,12 +131,14 @@ import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
128131
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
129132
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
130133
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
134+
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
131135
132136
import TextInput from '../fields/TextInput.vue'
133137
134138
import axios from '@nextcloud/axios'
135139
import { getFilePickerBuilder, showError } from '@nextcloud/dialogs'
136140
import { generateUrl } from '@nextcloud/router'
141+
import { loadState } from '@nextcloud/initial-state'
137142
138143
const _ScopeType = Object.freeze({
139144
NONE: 'none',
@@ -196,6 +201,7 @@ export default {
196201
NcCheckboxRadioSwitch,
197202
NcSelect,
198203
PlaylistRemoveIcon,
204+
NcNoteCard,
199205
},
200206
201207
props: {
@@ -221,6 +227,7 @@ export default {
221227
defaultProviderKey: 'files__default',
222228
223229
sccEnabled: !!this.inputs.scopeType && this.inputs.scopeType !== _ScopeType.NONE && !!this.inputs.scopeList,
230+
indexingComplete: loadState('assistant', 'contextChatIndexingComplete'),
224231
}
225232
},
226233

0 commit comments

Comments
 (0)