Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3274c7f
feat(audiochat): implement generic audio chat provider that schedules…
julien-nc Jul 3, 2025
b98e717
feat(audio-chat): record audio, store file, submit new fake message
julien-nc Jul 3, 2025
285b40d
feat(audio-chat): adjust UI to really submit, handle audio attachment…
julien-nc Jul 4, 2025
0c0ed92
feat(audio-chat): auto play new assistant audio messages
julien-nc Jul 4, 2025
2d53275
feat(audio-chat): generate openAPI specs
julien-nc Jul 7, 2025
3a706b8
feat(audio-chat): remove fallback task type, register provider only i…
julien-nc Jul 7, 2025
ffe2bcf
feat(audio-chat): filter out the audio chat task type in the assistan…
julien-nc Jul 7, 2025
7594d46
feat(audio-chat): implement ContextAgentAudioInteraction provider and…
julien-nc Jul 7, 2025
9a72e81
feat(audio-chat): add personal setting to toggle autoplay, fix person…
julien-nc Jul 8, 2025
bb6124e
feat(audio-chat): make sure attachments are always set in the entity
julien-nc Jul 8, 2025
e609d1d
feat(audio-chat): perform TTS for response after agency confirmation
julien-nc Jul 8, 2025
ba4ea60
feat(audio-chat): add support for optional remote_audio_id which we c…
julien-nc Jul 9, 2025
4cecfca
fix(chat): delete related tasks when deleting a session or a message,…
julien-nc Jul 10, 2025
cb6529a
feat(audio-chat): store and use potential remote_audio_expires_at
julien-nc Jul 10, 2025
6d85f2d
fix(audio-chat): prevent crash when trying to delete non existing task
julien-nc Jul 10, 2025
330296c
check if audio chat is available to show the record button, filter ou…
julien-nc Jul 11, 2025
4eb342f
clarify message mapper, use sessionId in deleteMessageById and getMes…
julien-nc Jul 11, 2025
891bb75
in regenerateForSession, delete task related with the deleted message
julien-nc Jul 11, 2025
003cdb3
rename initial state, mention integration_openai in comments, add mis…
julien-nc Jul 11, 2025
5cc7c59
fix typos
julien-nc Jul 11, 2025
7afb3e1
fix(audio-chat): update session title if the first message was audio,…
julien-nc Jul 11, 2025
77c2647
enh(audio-chat): add warning log if TTS of agency post-confirmation m…
julien-nc Jul 15, 2025
cf6648a
enh(audio-chat): add comments and adjust frontend error messages
julien-nc Jul 15, 2025
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
Prev Previous commit
Next Next commit
check if audio chat is available to show the record button, filter ou…
…t ContextAgentAudioInteraction in the assistant task type list, change the audio html tag border radius

Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Jul 15, 2025
commit 330296c170c809414ff82990f2ff30f0ba3c8102
1 change: 1 addition & 0 deletions lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function handle(Event $event): void {
$indexingComplete = $this->appConfig->getValueInt('context_chat', 'last_indexed_time', 0) !== 0;
$this->initialStateService->provideInitialState('contextChatIndexingComplete', $indexingComplete);
$this->initialStateService->provideInitialState('contextAgentToolSources', $this->assistantService->informationSources);
$this->initialStateService->provideInitialState('isAudioChatAvailable', $this->assistantService->isAudioChatAvailable());
$autoplayAudioChat = $this->config->getUserValue($this->userId, Application::APP_ID, 'autoplay_audio_chat', '1') === '1';
$this->initialStateService->provideInitialState('autoplayAudioChat', $autoplayAudioChat);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Listener/ChattyLLMTaskListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use OCP\EventDispatcher\IEventListener;
use OCP\TaskProcessing\Events\TaskSuccessfulEvent;
use OCP\TaskProcessing\Task;
use OCP\TaskProcessing\TaskTypes\TextToSpeech;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -96,6 +95,7 @@ public function handle(Event $event): void {
$queryMessage = $this->messageMapper->getMessageById($queryMessageId);
$queryMessage->setContent(trim($taskOutput['input_transcript'] ?? ''));
$this->messageMapper->update($queryMessage);
// TODO update session title if it's the first message
}
} else {
$content = trim($taskOutput['output'] ?? '');
Expand Down Expand Up @@ -138,7 +138,7 @@ private function runTtsIfNeeded(int $sessionId, Message $message, string $taskTy
$attachments = $lastNonEmptyMessage->jsonSerialize()['attachments'] ?? [];
foreach ($attachments as $attachment) {
if ($attachment['type'] === 'Audio') {
// we found an audio attachment
// we found an audio attachment, response should be audio
$this->runTtsTask($message, $userId);
return;
}
Expand All @@ -152,7 +152,7 @@ private function runTtsIfNeeded(int $sessionId, Message $message, string $taskTy
*/
private function runTtsTask(Message $message, ?string $userId): void {
$task = new Task(
TextToSpeech::ID,
\OCP\TaskProcessing\TaskTypes\TextToSpeech::ID,
['input' => $message->getContent()],
Application::APP_ID . ':internal',
$userId,
Expand Down
15 changes: 15 additions & 0 deletions lib/Service/AssistantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ public function cancelNotifyWhenReady(int $taskId, string $userId): void {
$this->taskNotificationMapper->deleteByTaskId($taskId);
}

public function isAudioChatAvailable(): bool {
$availableTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
// we have at least the simple audio chat task type and the 3 sub task types available
return class_exists('OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat')
&& array_key_exists(\OCP\TaskProcessing\TaskTypes\AudioToAudioChat::ID, $availableTaskTypes)
&& array_key_exists(AudioToText::ID, $availableTaskTypes)
&& class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToSpeech')
&& array_key_exists(\OCP\TaskProcessing\TaskTypes\TextToSpeech::ID, $availableTaskTypes)
&& array_key_exists(TextToTextChat::ID, $availableTaskTypes);
}

/**
* @return array<AssistantTaskProcessingTaskType>
*/
Expand Down Expand Up @@ -281,6 +292,10 @@ public function getAvailableTaskTypes(): array {
&& $typeId === \OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::ID) {
continue;
}
if (class_exists('OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction')
&& $typeId === \OCP\TaskProcessing\TaskTypes\ContextAgentAudioInteraction::ID) {
continue;
}
if (class_exists('OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat')
&& $typeId === \OCP\TaskProcessing\TaskTypes\AudioToAudioChat::ID) {
continue;
Expand Down
8 changes: 8 additions & 0 deletions src/components/ChattyLLM/ChattyLLMInputForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,14 @@ export default {
getChatURL(`/sessions/${lastHumanMessage.session_id}/messages/${lastHumanMessage.id}`),
)
lastHumanMessage.content = updatedMessage.data.content
// TODO update session title (just i the frontend data, the db session is updated in the backend listener)
/*
const firstHumanMessage = this.messages.length === 1 && this.messages[0].role === Roles.HUMAN
if (firstHumanMessage) {
const session = this.sessions.find((session) => session.id === sessionId)
session.title = content
}
*/
}
},

Expand Down
4 changes: 3 additions & 1 deletion src/components/ChattyLLM/InputArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@update:model-value="$emit('update:chatContent', $event)"
@submit="$emit('submit', $event)" />
<div class="input-area__button-box">
<NcButton v-if="chatContent"
<NcButton v-if="!isAudioChatAvailable || chatContent"
class="input-area__button-box__button"
:aria-label="submitBtnAriaText"
:disabled="disabled || !chatContent.trim()"
Expand Down Expand Up @@ -49,6 +49,7 @@ import isMobile from '../../mixins/isMobile.js'
import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'

/*
maxlength calculation (just a rough estimate):
Expand Down Expand Up @@ -103,6 +104,7 @@ export default {
thinkingText: t('assistant', 'Processing…'),
submitBtnAriaText: t('assistant', 'Submit'),
isRecording: false,
isAudioChatAvailable: loadState('assistant', 'isAudioChatAvailable', false),
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/components/fields/AudioDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {

<style scoped lang="scss">
audio {
border-radius: 16px;
border-radius: 100px;
&.shadowed {
border: 2px solid var(--color-primary-element);
}
Expand Down