From 1d2daacc23ae799248055176f4929e78e005ce9a Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Fri, 8 Mar 2024 15:18:22 +0100 Subject: [PATCH] show empty content if no AI provider was found (if task type list is empty) Signed-off-by: Julien Veyssier --- .../BeforeTemplateRenderedListener.php | 6 -- src/components/AdminSettings.vue | 3 +- .../AssistantTextProcessingForm.vue | 12 +++- src/components/NoProviderEmptyContent.vue | 69 +++++++++++++++++++ 4 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 src/components/NoProviderEmptyContent.vue diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php index c2da303d..46a2804c 100644 --- a/lib/Listener/BeforeTemplateRenderedListener.php +++ b/lib/Listener/BeforeTemplateRenderedListener.php @@ -13,7 +13,6 @@ use OCP\IConfig; use OCP\IUser; use OCP\IUserSession; -use OCP\TextProcessing\IManager as ITextProcessingManager; use OCP\Util; /** @@ -26,7 +25,6 @@ public function __construct( private IConfig $config, private IInitialState $initialStateService, private ?string $userId, - private ITextProcessingManager $textProcessingManager ) { } @@ -44,10 +42,6 @@ public function handle(Event $event): void { return; } - if (!$this->textProcessingManager->hasProviders()) { - return; - } - $adminAssistantEnabled = $this->config->getAppValue(Application::APP_ID, 'assistant_enabled', '1') === '1'; $userAssistantEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'assistant_enabled', '1') === '1'; $assistantEnabled = $adminAssistantEnabled && $userAssistantEnabled; diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue index d6efd633..a99887a8 100644 --- a/src/components/AdminSettings.vue +++ b/src/components/AdminSettings.vue @@ -11,14 +11,13 @@
{{ t('assistant', 'Top-right assistant') }}
- {{ t('assistant', 'To enable this feature, please install any AI text processing provider.') }} + {{ t('assistant', 'To be able to use this feature, please install at least one AI text processing provider.') }}
diff --git a/src/components/AssistantTextProcessingForm.vue b/src/components/AssistantTextProcessingForm.vue index 4241521a..eea73c21 100644 --- a/src/components/AssistantTextProcessingForm.vue +++ b/src/components/AssistantTextProcessingForm.vue @@ -1,5 +1,8 @@