Skip to content
Open
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
19 changes: 17 additions & 2 deletions lib/private/TaskProcessing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,18 @@ private function _getTextToImageProviders(): array {
$oldProviders = $this->textToImageManager->getProviders();
$newProviders = [];
foreach ($oldProviders as $oldProvider) {
$newProvider = new class($oldProvider, $this->appData) implements IProvider, ISynchronousProvider {
$newProvider = new class($oldProvider, $this->appData, $this->l10nFactory, $this->userManager) implements IProvider, ISynchronousProvider {
private \OCP\TextToImage\IProvider $provider;
private IAppData $appData;
private IFactory $l10nFactory;

public function __construct(\OCP\TextToImage\IProvider $provider, IAppData $appData) {
private IUserManager $userManager;

public function __construct(\OCP\TextToImage\IProvider $provider, IAppData $appData, IFactory $l10nFactory, IUserManager $userManager) {
$this->provider = $provider;
$this->appData = $appData;
$this->l10nFactory = $l10nFactory;
$this->userManager = $userManager;
}

public function getId(): string {
Expand Down Expand Up @@ -342,6 +347,16 @@ public function process(?string $userId, array $input, callable $reportProgress)
} catch (\OCP\Files\NotFoundException) {
$folder = $this->appData->newFolder('text2image');
}
if ($input['numberOfImages'] > 12) {
throw new ProcessingException(
'numberOfImages cannot be greater than 12'
);
}
if ($input['numberOfImages'] < 1) {
throw new ProcessingException(
'numberOfImages must be greater than 0'
);
}
$resources = [];
$files = [];
for ($i = 0; $i < $input['numberOfImages']; $i++) {
Expand Down
Loading