Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',
'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php',
'OCP\\TaskProcessing\\TaskTypes\\ImageToImage' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ImageToImage.php',
'OCP\\TaskProcessing\\TaskTypes\\ImageToTextOpticalCharacterRecognition' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php',
'OCP\\TaskProcessing\\TaskTypes\\MultimodalChatWithTools' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/MultimodalChatWithTools.php',
'OCP\\TaskProcessing\\TaskTypes\\MultimodalContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/MultimodalContextAgentInteraction.php',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',
'OCP\\TaskProcessing\\TaskTypes\\GenerateEmoji' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/GenerateEmoji.php',
'OCP\\TaskProcessing\\TaskTypes\\ImageToImage' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ImageToImage.php',
'OCP\\TaskProcessing\\TaskTypes\\ImageToTextOpticalCharacterRecognition' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ImageToTextOpticalCharacterRecognition.php',
'OCP\\TaskProcessing\\TaskTypes\\MultimodalChatWithTools' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/MultimodalChatWithTools.php',
'OCP\\TaskProcessing\\TaskTypes\\MultimodalContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/MultimodalContextAgentInteraction.php',
Expand Down
2 changes: 2 additions & 0 deletions lib/private/TaskProcessing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
use OCP\TaskProcessing\TaskTypes\ContextAgentInteraction;
use OCP\TaskProcessing\TaskTypes\ContextWrite;
use OCP\TaskProcessing\TaskTypes\GenerateEmoji;
use OCP\TaskProcessing\TaskTypes\ImageToImage;
use OCP\TaskProcessing\TaskTypes\ImageToTextOpticalCharacterRecognition;
use OCP\TaskProcessing\TaskTypes\MultimodalChatWithTools;
use OCP\TaskProcessing\TaskTypes\MultimodalContextAgentInteraction;
Expand Down Expand Up @@ -713,6 +714,7 @@ private function _getTaskTypes(): array {
MultimodalContextAgentInteraction::ID => Server::get(MultimodalContextAgentInteraction::class),
AnalyzeImages::ID => Server::get(AnalyzeImages::class),
ImageToTextOpticalCharacterRecognition::ID => Server::get(ImageToTextOpticalCharacterRecognition::class),
ImageToImage::ID => Server::get(ImageToImage::class),
];

foreach ($context->getTaskProcessingTaskTypes() as $providerServiceRegistration) {
Expand Down
101 changes: 101 additions & 0 deletions lib/public/TaskProcessing/TaskTypes/ImageToImage.php
Original file line number Diff line number Diff line change
@@ -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 editing images
* @since 36.0.0
*/
class ImageToImage implements ITaskType {
/**
* @since 36.0.0
*/
public const string ID = 'core:image2image';

private IL10N $l;

/**
* @param IFactory $l10nFactory
* @since 36.0.0
*/
public function __construct(
IFactory $l10nFactory,
) {
$this->l = $l10nFactory->get('lib');
}

/**
* @inheritDoc
* @since 36.0.0
*/
#[\Override]
public function getName(): string {
return $this->l->t('Edit image');
}

/**
* @inheritDoc
* @since 36.0.0
*/
#[\Override]
public function getDescription(): string {
return $this->l->t('Edit an image based on a text description of the changes');
}

/**
* @return string
* @since 36.0.0
*/
#[\Override]
public function getId(): string {
return self::ID;
}

/**
* @return ShapeDescriptor[]
* @since 36.0.0
*/
#[\Override]
public function getInputShape(): array {
return [
'input' => new ShapeDescriptor(
$this->l->t('Input images'),
$this->l->t('The images to edit'),
EShapeType::ListOfImages
),
'prompt' => new ShapeDescriptor(
$this->l->t('Prompt'),
$this->l->t('Describe the changes you want to make to the image'),
EShapeType::Text
),
];
}

/**
* @return ShapeDescriptor[]
* @since 36.0.0
*/
#[\Override]
public function getOutputShape(): array {
return [
'output' => new ShapeDescriptor(
$this->l->t('Output image'),
$this->l->t('The edited image'),
EShapeType::Image
),
];
}
}
Loading