Skip to content

Commit a2a06ec

Browse files
authored
Merge pull request #60171 from nextcloud/feat/task/reformat-paragraphs
feat(TaskProcessing): add TextToTextReformatParagraphs task type
2 parents 548708d + 574243f commit a2a06ec

4 files changed

Lines changed: 100 additions & 0 deletions

File tree

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@
949949
'OCP\\TaskProcessing\\TaskTypes\\TextToTextFormalization' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php',
950950
'OCP\\TaskProcessing\\TaskTypes\\TextToTextHeadline' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php',
951951
'OCP\\TaskProcessing\\TaskTypes\\TextToTextProofread' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php',
952+
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformatParagraphs' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformatParagraphs.php',
952953
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformulation' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php',
953954
'OCP\\TaskProcessing\\TaskTypes\\TextToTextSimplification' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php',
954955
'OCP\\TaskProcessing\\TaskTypes\\TextToTextSummary' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
990990
'OCP\\TaskProcessing\\TaskTypes\\TextToTextFormalization' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php',
991991
'OCP\\TaskProcessing\\TaskTypes\\TextToTextHeadline' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php',
992992
'OCP\\TaskProcessing\\TaskTypes\\TextToTextProofread' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php',
993+
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformatParagraphs' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformatParagraphs.php',
993994
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformulation' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php',
994995
'OCP\\TaskProcessing\\TaskTypes\\TextToTextSimplification' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextSimplification.php',
995996
'OCP\\TaskProcessing\\TaskTypes\\TextToTextSummary' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextSummary.php',

lib/private/TaskProcessing/Manager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
use OCP\TaskProcessing\TaskTypes\TextToTextFormalization;
8585
use OCP\TaskProcessing\TaskTypes\TextToTextHeadline;
8686
use OCP\TaskProcessing\TaskTypes\TextToTextProofread;
87+
use OCP\TaskProcessing\TaskTypes\TextToTextReformatParagraphs;
8788
use OCP\TaskProcessing\TaskTypes\TextToTextReformulation;
8889
use OCP\TaskProcessing\TaskTypes\TextToTextSimplification;
8990
use OCP\TaskProcessing\TaskTypes\TextToTextSummary;
@@ -689,6 +690,7 @@ private function _getTaskTypes(): array {
689690
TextToTextChatWithTools::ID => Server::get(TextToTextChatWithTools::class),
690691
ContextAgentInteraction::ID => Server::get(ContextAgentInteraction::class),
691692
TextToTextProofread::ID => Server::get(TextToTextProofread::class),
693+
TextToTextReformatParagraphs::ID => Server::get(TextToTextReformatParagraphs::class),
692694
TextToSpeech::ID => Server::get(TextToSpeech::class),
693695
AudioToAudioChat::ID => Server::get(AudioToAudioChat::class),
694696
ContextAgentAudioInteraction::ID => Server::get(ContextAgentAudioInteraction::class),
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 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 reformatting text into paragraphs
20+
* @since 34.0.0
21+
*/
22+
class TextToTextReformatParagraphs implements ITaskType {
23+
/**
24+
* @since 34.0.0
25+
*/
26+
public const ID = 'core:text2text:reformatparagraphs';
27+
28+
private IL10N $l;
29+
30+
/**
31+
* @param IFactory $l10nFactory
32+
* @since 34.0.0
33+
*/
34+
public function __construct(
35+
IFactory $l10nFactory,
36+
) {
37+
$this->l = $l10nFactory->get('lib');
38+
}
39+
40+
/**
41+
* @inheritDoc
42+
* @since 34.0.0
43+
*/
44+
#[\Override]
45+
public function getName(): string {
46+
return $this->l->t('Reformat paragraphs');
47+
}
48+
49+
/**
50+
* @inheritDoc
51+
* @since 34.0.0
52+
*/
53+
#[\Override]
54+
public function getDescription(): string {
55+
return $this->l->t('Reformats a text into multiple paragraphs separated by topic');
56+
}
57+
58+
/**
59+
* @return string
60+
* @since 34.0.0
61+
*/
62+
#[\Override]
63+
public function getId(): string {
64+
return self::ID;
65+
}
66+
67+
/**
68+
* @return ShapeDescriptor[]
69+
* @since 34.0.0
70+
*/
71+
#[\Override]
72+
public function getInputShape(): array {
73+
return [
74+
'input' => new ShapeDescriptor(
75+
$this->l->t('Text'),
76+
$this->l->t('The text to reformat'),
77+
EShapeType::Text
78+
),
79+
];
80+
}
81+
82+
/**
83+
* @return ShapeDescriptor[]
84+
* @since 34.0.0
85+
*/
86+
#[\Override]
87+
public function getOutputShape(): array {
88+
return [
89+
'output' => new ShapeDescriptor(
90+
$this->l->t('Reformatted text'),
91+
$this->l->t('The reformatted text with paragraphs separated by topic'),
92+
EShapeType::Text
93+
),
94+
];
95+
}
96+
}

0 commit comments

Comments
 (0)