namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\ShapeEnumValue;
class FakeContextWriteProvider implements ISynchronousProvider {
- public function __construct() {
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
}
public function getId(): string {
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (
!isset($input['style_input']) || !is_string($input['style_input'])
|| !isset($input['source_input']) || !is_string($input['source_input'])
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\TaskTypes\TextToImage;
class FakeTextToImageProvider implements ISynchronousProvider {
- public function __construct() {
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
}
public function getId(): string {
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (!isset($input['input']) || !is_string($input['input'])) {
throw new RuntimeException('Invalid prompt');
}
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\ShapeEnumValue;
class FakeTextToTextProvider implements ISynchronousProvider {
- public function __construct() {
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
}
public function getId(): string {
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (isset($input['model']) && is_string($input['model'])) {
$model = $input['model'];
} else {
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\ShapeEnumValue;
class FakeTextToTextSummaryProvider implements ISynchronousProvider {
- public function __construct() {
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
}
public function getId(): string {
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (isset($input['model']) && is_string($input['model'])) {
$model = $input['model'];
} else {
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\Files\File;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\TaskTypes\AudioToText;
use RuntimeException;
class FakeTranscribeProvider implements ISynchronousProvider {
public function __construct(
+ protected IAppConfig $appConfig,
) {
}
if (!isset($input['input']) || !$input['input'] instanceof File || !$input['input']->isReadable()) {
throw new RuntimeException('Invalid input file');
}
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
$inputFile = $input['input'];
$transcription = 'Fake transcription result';
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\L10N\IFactory;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\ShapeEnumValue;
public function __construct(
private IFactory $l10nFactory,
+ protected IAppConfig $appConfig,
) {
}
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (isset($input['model']) && is_string($input['model'])) {
$model = $input['model'];
} else {