Skip to content

Commit 58a3710

Browse files
authored
Merge pull request #53759 from nextcloud/enh/noid/taskpro-audio-chat
[TaskProcessing] Add audio-to-audio chat task type
2 parents f9cdb94 + af059cb commit 58a3710

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@
842842
'OCP\\TaskProcessing\\ShapeDescriptor' => $baseDir . '/lib/public/TaskProcessing/ShapeDescriptor.php',
843843
'OCP\\TaskProcessing\\ShapeEnumValue' => $baseDir . '/lib/public/TaskProcessing/ShapeEnumValue.php',
844844
'OCP\\TaskProcessing\\Task' => $baseDir . '/lib/public/TaskProcessing/Task.php',
845+
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
845846
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
846847
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
847848
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
883883
'OCP\\TaskProcessing\\ShapeDescriptor' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/ShapeDescriptor.php',
884884
'OCP\\TaskProcessing\\ShapeEnumValue' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/ShapeEnumValue.php',
885885
'OCP\\TaskProcessing\\Task' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/Task.php',
886+
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
886887
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
887888
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
888889
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

lib/private/TaskProcessing/Manager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ private function _getTaskTypes(): array {
589589
\OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\ContextAgentInteraction::class),
590590
\OCP\TaskProcessing\TaskTypes\TextToTextProofread::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\TextToTextProofread::class),
591591
\OCP\TaskProcessing\TaskTypes\TextToSpeech::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\TextToSpeech::class),
592+
\OCP\TaskProcessing\TaskTypes\AudioToAudioChat::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\AudioToAudioChat::class),
592593
];
593594

594595
foreach ($context->getTaskProcessingTaskTypes() as $providerServiceRegistration) {
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCP\TaskProcessing\TaskTypes;
11+
12+
use OCP\IL10N;
13+
use OCP\L10N\IFactory;
14+
use OCP\TaskProcessing\EShapeType;
15+
use OCP\TaskProcessing\ITaskType;
16+
use OCP\TaskProcessing\ShapeDescriptor;
17+
18+
/**
19+
* This is the task processing task type for text chat
20+
* @since 32.0.0
21+
*/
22+
class AudioToAudioChat implements ITaskType {
23+
/**
24+
* @since 32.0.0
25+
*/
26+
public const ID = 'core:audio2audio:chat';
27+
28+
private IL10N $l;
29+
30+
/**
31+
* @param IFactory $l10nFactory
32+
* @since 32.0.0
33+
*/
34+
public function __construct(
35+
IFactory $l10nFactory,
36+
) {
37+
$this->l = $l10nFactory->get('lib');
38+
}
39+
40+
41+
/**
42+
* @inheritDoc
43+
* @since 32.0.0
44+
*/
45+
public function getName(): string {
46+
return $this->l->t('Audio chat');
47+
}
48+
49+
/**
50+
* @inheritDoc
51+
* @since 32.0.0
52+
*/
53+
public function getDescription(): string {
54+
return $this->l->t('Voice chat with the assistant');
55+
}
56+
57+
/**
58+
* @return string
59+
* @since 32.0.0
60+
*/
61+
public function getId(): string {
62+
return self::ID;
63+
}
64+
65+
/**
66+
* @return ShapeDescriptor[]
67+
* @since 32.0.0
68+
*/
69+
public function getInputShape(): array {
70+
return [
71+
'system_prompt' => new ShapeDescriptor(
72+
$this->l->t('System prompt'),
73+
$this->l->t('Define rules and assumptions that the assistant should follow during the conversation.'),
74+
EShapeType::Text
75+
),
76+
'input' => new ShapeDescriptor(
77+
$this->l->t('Chat voice message'),
78+
$this->l->t('Describe a task that you want the assistant to do or ask a question'),
79+
EShapeType::Audio
80+
),
81+
'history' => new ShapeDescriptor(
82+
$this->l->t('Chat history'),
83+
$this->l->t('The history of chat messages before the current message, starting with a message by the user'),
84+
EShapeType::ListOfTexts
85+
)
86+
];
87+
}
88+
89+
/**
90+
* @return ShapeDescriptor[]
91+
* @since 32.0.0
92+
*/
93+
public function getOutputShape(): array {
94+
return [
95+
'input_transcript' => new ShapeDescriptor(
96+
$this->l->t('Input transcript'),
97+
$this->l->t('Transcription of the audio input'),
98+
EShapeType::Text,
99+
),
100+
'output' => new ShapeDescriptor(
101+
$this->l->t('Response voice message'),
102+
$this->l->t('The generated voice response as part of the conversation'),
103+
EShapeType::Audio
104+
),
105+
'output_transcript' => new ShapeDescriptor(
106+
$this->l->t('Output transcript'),
107+
$this->l->t('Transcription of the audio output'),
108+
EShapeType::Text,
109+
),
110+
];
111+
}
112+
}

0 commit comments

Comments
 (0)