Skip to content

Commit 1bec314

Browse files
committed
enh(audio-chat): add warning log if TTS of agency post-confirmation message failed
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 7fffd2b commit 1bec314

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lib/Listener/ChattyLLMTaskListener.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,21 @@ private function runTtsIfNeeded(int $sessionId, Message $message, string $taskTy
156156
* @return void
157157
*/
158158
private function runTtsTask(Message $message, ?string $userId): void {
159-
$task = new Task(
160-
\OCP\TaskProcessing\TaskTypes\TextToSpeech::ID,
161-
['input' => $message->getContent()],
162-
Application::APP_ID . ':internal',
163-
$userId,
164-
);
165-
$ttsTaskOutput = $this->taskProcessingService->runTaskProcessingTask($task);
159+
try {
160+
$task = new Task(
161+
\OCP\TaskProcessing\TaskTypes\TextToSpeech::ID,
162+
['input' => $message->getContent()],
163+
Application::APP_ID . ':internal',
164+
$userId,
165+
);
166+
$ttsTaskOutput = $this->taskProcessingService->runTaskProcessingTask($task);
167+
} catch (\OCP\TaskProcessing\Exception\Exception $e) {
168+
$this->logger->warning('TTS sub-task failed for chat message.', [
169+
'exception' => $e,
170+
'messageId' => $message->getId(),
171+
]);
172+
return;
173+
}
166174
$speechFileId = $ttsTaskOutput['speech'];
167175
// we need to set "ocp_task_id" here because the file is not an output of the task that produced the message
168176
// and we need the task ID + the file ID to load the audio file in the frontend

0 commit comments

Comments
 (0)