Skip to content

Commit f05ae48

Browse files
authored
Merge pull request #53846 from nextcloud/enh/noid/taskpro-agency-audio-chat
[TaskProcessing] Add agency audio-to-audio task type
2 parents 58e1427 + 2da3f45 commit f05ae48

File tree

5 files changed

+124
-3
lines changed

5 files changed

+124
-3
lines changed

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@
844844
'OCP\\TaskProcessing\\Task' => $baseDir . '/lib/public/TaskProcessing/Task.php',
845845
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
846846
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
847+
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
847848
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
848849
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',
849850
'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
885885
'OCP\\TaskProcessing\\Task' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/Task.php',
886886
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
887887
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
888+
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
888889
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
889890
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',
890891
'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php',

lib/private/TaskProcessing/Manager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ private function _getTaskTypes(): array {
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),
592592
\OCP\TaskProcessing\TaskTypes\AudioToAudioChat::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\AudioToAudioChat::class),
593+
\OCP\TaskProcessing\TaskTypes\ContextAgentAudioInteraction::ID => \OCP\Server::get(\OCP\TaskProcessing\TaskTypes\ContextAgentAudioInteraction::class),
593594
];
594595

595596
foreach ($context->getTaskProcessingTaskTypes() as $providerServiceRegistration) {

lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use OCP\TaskProcessing\ShapeDescriptor;
1717

1818
/**
19-
* This is the task processing task type for text chat
19+
* This is the task processing task type for audio chat
2020
* @since 32.0.0
2121
*/
2222
class AudioToAudioChat implements ITaskType {
@@ -75,12 +75,12 @@ public function getInputShape(): array {
7575
),
7676
'input' => new ShapeDescriptor(
7777
$this->l->t('Chat voice message'),
78-
$this->l->t('Describe a task that you want the assistant to do or ask a question'),
78+
$this->l->t('Describe a task that you want the assistant to do or ask a question.'),
7979
EShapeType::Audio
8080
),
8181
'history' => new ShapeDescriptor(
8282
$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'),
83+
$this->l->t('The history of chat messages before the current message, starting with a message by the user.'),
8484
EShapeType::ListOfTexts
8585
)
8686
];
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 Context Agent interaction
20+
* @since 32.0.0
21+
*/
22+
class ContextAgentAudioInteraction implements ITaskType {
23+
public const ID = 'core:contextagent:audio-interaction';
24+
25+
private IL10N $l;
26+
27+
/**
28+
* @param IFactory $l10nFactory
29+
* @since 32.0.0
30+
*/
31+
public function __construct(
32+
IFactory $l10nFactory,
33+
) {
34+
$this->l = $l10nFactory->get('lib');
35+
}
36+
37+
/**
38+
* @inheritDoc
39+
* @since 32.0.0
40+
*/
41+
public function getName(): string {
42+
return 'ContextAgent audio'; // We do not translate this
43+
}
44+
45+
/**
46+
* @inheritDoc
47+
* @since 32.0.0
48+
*/
49+
public function getDescription(): string {
50+
return $this->l->t('Chat by voice with an agent');
51+
}
52+
53+
/**
54+
* @return string
55+
* @since 32.0.0
56+
*/
57+
public function getId(): string {
58+
return self::ID;
59+
}
60+
61+
/**
62+
* @return ShapeDescriptor[]
63+
* @since 32.0.0
64+
*/
65+
public function getInputShape(): array {
66+
return [
67+
'input' => new ShapeDescriptor(
68+
$this->l->t('Chat voice message'),
69+
$this->l->t('Describe a task that you want the agent to do or ask a question.'),
70+
EShapeType::Audio
71+
),
72+
'confirmation' => new ShapeDescriptor(
73+
$this->l->t('Confirmation'),
74+
$this->l->t('Whether to confirm previously requested actions: 0 for denial and 1 for confirmation.'),
75+
EShapeType::Number
76+
),
77+
'conversation_token' => new ShapeDescriptor(
78+
$this->l->t('Conversation token'),
79+
$this->l->t('A token representing the conversation.'),
80+
EShapeType::Text
81+
),
82+
];
83+
}
84+
85+
/**
86+
* @return ShapeDescriptor[]
87+
* @since 32.0.0
88+
*/
89+
public function getOutputShape(): array {
90+
return [
91+
'input_transcript' => new ShapeDescriptor(
92+
$this->l->t('Input transcript'),
93+
$this->l->t('Transcription of the audio input'),
94+
EShapeType::Text,
95+
),
96+
'output' => new ShapeDescriptor(
97+
$this->l->t('Response voice message'),
98+
$this->l->t('The generated voice response as part of the conversation'),
99+
EShapeType::Audio
100+
),
101+
'output_transcript' => new ShapeDescriptor(
102+
$this->l->t('Output transcript'),
103+
$this->l->t('Transcription of the audio output'),
104+
EShapeType::Text,
105+
),
106+
'conversation_token' => new ShapeDescriptor(
107+
$this->l->t('The new conversation token'),
108+
$this->l->t('Send this along with the next interaction.'),
109+
EShapeType::Text
110+
),
111+
'actions' => new ShapeDescriptor(
112+
$this->l->t('Requested actions by the agent'),
113+
$this->l->t('Actions that the agent would like to carry out in JSON format.'),
114+
EShapeType::Text
115+
),
116+
];
117+
}
118+
}

0 commit comments

Comments
 (0)