Skip to content

Commit c3b0a51

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

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/Listener/BeforeTemplateRenderedListener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct(
3535
private IInitialState $initialStateService,
3636
private IEventDispatcher $eventDispatcher,
3737
private ?string $userId,
38+
private IAppConfig $allAppConfig,
3839
) {
3940
}
4041

@@ -61,6 +62,8 @@ public function handle(Event $event): void {
6162
if ($assistantEnabled) {
6263
$lastTargetLanguage = $this->config->getUserValue($this->userId, Application::APP_ID, 'last_target_language', '');
6364
$this->initialStateService->provideInitialState('last-target-language', $lastTargetLanguage);
65+
$indexingComplete = $this->allAppConfig->getValueInt('context_chat', 'last_indexed_time', 0) !== 0;
66+
$this->initialStateService->provideInitialState('contextChatIndexingComplete', $indexingComplete);
6467
}
6568
Util::addScript(Application::APP_ID, Application::APP_ID . '-main');
6669
}

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)