Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserSession;
use OCP\TaskProcessing\IManager;
use OCP\Util;

/**
Expand All @@ -37,6 +38,7 @@ public function __construct(
private IEventDispatcher $eventDispatcher,
private AssistantService $assistantService,
private ?string $userId,
private IManager $taskProcessingManager,
) {
}

Expand Down Expand Up @@ -72,6 +74,8 @@ public function handle(Event $event): void {
$this->initialStateService->provideInitialState('audio_chat_available', $this->assistantService->isAudioChatAvailable());
$autoplayAudioChat = $this->config->getUserValue($this->userId, Application::APP_ID, 'autoplay_audio_chat', '1') === '1';
$this->initialStateService->provideInitialState('autoplay_audio_chat', $autoplayAudioChat);
$agencyAvailable = class_exists('OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction') && array_key_exists(\OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::ID, $this->taskProcessingManager->getAvailableTaskTypes());
$this->initialStateService->provideInitialState('agency_available', $agencyAvailable);
}
if (class_exists(\OCA\Viewer\Event\LoadViewer::class)) {
$this->eventDispatcher->dispatchTyped(new \OCA\Viewer\Event\LoadViewer());
Expand Down
40 changes: 40 additions & 0 deletions src/components/ChattyLLM/ChattyLLMInputForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@
<template #icon>
<AssistantIcon />
</template>
<template #action>
<div v-if="agencyAvailable" class="session-area__agency-suggestions">
<NcButton v-for="suggestion in agencySuggestions"
:key="suggestion.message"
class="session-area__agency-suggestion"
:aria-label="suggestion.aria"
variant="tertiary"
@click="chatContent = suggestion.message">
{{ t('assistant', suggestion.message) }}
</NcButton>
</div>
</template>
</NoSession>
<div v-else
class="session-area__chat-area__active-session"
Expand Down Expand Up @@ -232,6 +244,7 @@ export default {
},

data: () => {
const agencyAvailable = loadState('assistant', 'agency_available', false)
return {
// { id: number, title: string, user_id: string, timestamp: number }
active: null,
Expand Down Expand Up @@ -261,6 +274,21 @@ export default {
pollTitleGenerationTimerId: null,
autoplayAudioChat: loadState('assistant', 'autoplay_audio_chat', true),
slowPickup: false,
agencyAvailable,
agencySuggestions: [
{
aria: t('assisant', 'Ask assistant, what\'s the weather in Berlin right now'),
message: t('assisant', 'What\'s the weather in Berlin right now?'),
},
{
aria: t('assisant', 'Ask assistant, to create a share link for a file'),
message: t('assisant', 'Can you create a share link for the following file in my documents? welcome.txt'),
},
{
aria: t('assisant', 'Ask assistant, which actions it can do for you'),
message: t('assisant', 'Which actions can you do for me?'),
},
],
}
},

Expand Down Expand Up @@ -1023,6 +1051,18 @@ export default {
position: sticky;
bottom: 0;
}

&__agency-suggestions {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
flex-wrap: wrap;
justify-content: center;
}
&__agency-suggestion {
flex-shrink: 0;
}
}
}
</style>
3 changes: 3 additions & 0 deletions src/components/ChattyLLM/NoSession.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<template #icon>
<slot name="icon" />
</template>
<template #action>
<slot name="action" />
</template>
</NcEmptyContent>
</template>

Expand Down