mirror of
https://github.com/nextcloud/server.git
synced 2026-07-12 02:57:52 -04:00
Merge pull request #61683 from nextcloud/improve-task-type
feat(TaskProcessing): add TextToTextImprove to improve or iterate on text
This commit is contained in:
commit
a8bc261e10
4 changed files with 105 additions and 0 deletions
|
|
@ -958,6 +958,7 @@ return array(
|
|||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextChatWithTools' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextFormalization' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextHeadline' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextImprove' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextImprove.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextProofread' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformatParagraphs' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformatParagraphs.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformulation' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php',
|
||||
|
|
|
|||
|
|
@ -999,6 +999,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextChatWithTools' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextFormalization' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextFormalization.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextHeadline' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextHeadline.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextImprove' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextImprove.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextProofread' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextProofread.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformatParagraphs' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformatParagraphs.php',
|
||||
'OCP\\TaskProcessing\\TaskTypes\\TextToTextReformulation' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/TextToTextReformulation.php',
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ use OCP\TaskProcessing\TaskTypes\TextToTextChat;
|
|||
use OCP\TaskProcessing\TaskTypes\TextToTextChatWithTools;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextFormalization;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextHeadline;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextImprove;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextProofread;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextReformatParagraphs;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToTextReformulation;
|
||||
|
|
@ -687,6 +688,7 @@ class Manager implements IManager {
|
|||
TextToTextChat::ID => Server::get(TextToTextChat::class),
|
||||
TextToTextTranslate::ID => Server::get(TextToTextTranslate::class),
|
||||
TextToTextReformulation::ID => Server::get(TextToTextReformulation::class),
|
||||
TextToTextImprove::ID => Server::get(TextToTextImprove::class),
|
||||
TextToImage::ID => Server::get(TextToImage::class),
|
||||
AudioToText::ID => Server::get(AudioToText::class),
|
||||
AudioToTextSubtitles::ID => Server::get(AudioToTextSubtitles::class),
|
||||
|
|
|
|||
101
lib/public/TaskProcessing/TaskTypes/TextToTextImprove.php
Normal file
101
lib/public/TaskProcessing/TaskTypes/TextToTextImprove.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCP\TaskProcessing\TaskTypes;
|
||||
|
||||
use OCP\IL10N;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\TaskProcessing\EShapeType;
|
||||
use OCP\TaskProcessing\ITaskType;
|
||||
use OCP\TaskProcessing\ShapeDescriptor;
|
||||
|
||||
/**
|
||||
* This is the task processing task type for improving text
|
||||
* @since 35.0.0
|
||||
*/
|
||||
class TextToTextImprove implements ITaskType {
|
||||
/**
|
||||
* @since 35.0.0
|
||||
*/
|
||||
public const ID = 'core:text2text:improve';
|
||||
|
||||
private IL10N $l;
|
||||
|
||||
/**
|
||||
* @param IFactory $l10nFactory
|
||||
* @since 35.0.0
|
||||
*/
|
||||
public function __construct(
|
||||
IFactory $l10nFactory,
|
||||
) {
|
||||
$this->l = $l10nFactory->get('lib');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @since 35.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getName(): string {
|
||||
return $this->l->t('Improve text');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @since 35.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getDescription(): string {
|
||||
return $this->l->t('Takes a text and improves it based on instructions');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 35.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getId(): string {
|
||||
return self::ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShapeDescriptor[]
|
||||
* @since 35.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getInputShape(): array {
|
||||
return [
|
||||
'input' => new ShapeDescriptor(
|
||||
$this->l->t('Input text'),
|
||||
$this->l->t('Write a text that you want the assistant to improve'),
|
||||
EShapeType::Text
|
||||
),
|
||||
'instructions' => new ShapeDescriptor(
|
||||
$this->l->t('Instructions'),
|
||||
$this->l->t('Describe how the assistant should improve the text'),
|
||||
EShapeType::Text
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ShapeDescriptor[]
|
||||
* @since 35.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getOutputShape(): array {
|
||||
return [
|
||||
'output' => new ShapeDescriptor(
|
||||
$this->l->t('Improved text'),
|
||||
$this->l->t('The improved text'),
|
||||
EShapeType::Text
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue