aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2024-05-03 11:46:36 +0200
committerMarcel Klehr <mklehr@gmx.net>2024-05-14 11:38:40 +0200
commitc9ea5375d87a90a5c25a5858aed6fdcb1b035a9f (patch)
tree7f41d162754e3bd038e8166c2078aeb97771e47b /lib
parent843bb62d6dd795803c9e423c4979521b70c55085 (diff)
downloadnextcloud-server-c9ea5375d87a90a5c25a5858aed6fdcb1b035a9f.tar.gz
nextcloud-server-c9ea5375d87a90a5c25a5858aed6fdcb1b035a9f.zip
fix: Fix psalm issues
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/TaskProcessing/Manager.php10
-rw-r--r--lib/public/TaskProcessing/EShapeType.php1
-rw-r--r--lib/public/TaskProcessing/ShapeDescriptor.php1
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php
index 8b145be8a65..793bcec6364 100644
--- a/lib/private/TaskProcessing/Manager.php
+++ b/lib/private/TaskProcessing/Manager.php
@@ -38,7 +38,9 @@ use OCP\Files\GenericFileException;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
+use OCP\IL10N;
use OCP\IServerContainer;
+use OCP\L10N\IFactory;
use OCP\Lock\LockedException;
use OCP\PreConditionNotMetException;
use OCP\SpeechToText\ISpeechToTextProvider;
@@ -180,10 +182,12 @@ class Manager implements IManager {
$taskType = new class($oldProvider->getTaskType()) implements ITaskType {
private string $oldTaskTypeClass;
private \OCP\TextProcessing\ITaskType $oldTaskType;
+ private IL10N $l;
public function __construct(string $oldTaskTypeClass) {
$this->oldTaskTypeClass = $oldTaskTypeClass;
$this->oldTaskType = \OCP\Server::get($oldTaskTypeClass);
+ $this->l = \OCP\Server::get(IFactory::class)->get('core');
}
public function getId(): string {
@@ -199,11 +203,11 @@ class Manager implements IManager {
}
public function getInputShape(): array {
- return ['input' => EShapeType::Text];
+ return ['input' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)];
}
public function getOutputShape(): array {
- return ['output' => EShapeType::Text];
+ return ['output' => new ShapeDescriptor($this->l->t('Input text'), $this->l->t('The input text'), EShapeType::Text)];
}
};
$newTaskTypes[$taskType->getId()] = $taskType;
@@ -283,7 +287,7 @@ class Manager implements IManager {
} catch (\RuntimeException $e) {
throw new ProcessingException($e->getMessage(), 0, $e);
}
- return ['images' => array_map(fn (File $file) => base64_encode($file->getContent()), $files)];
+ return ['images' => array_map(fn (File $file) => $file->getContent(), $files)];
}
};
$newProviders[$newProvider->getId()] = $newProvider;
diff --git a/lib/public/TaskProcessing/EShapeType.php b/lib/public/TaskProcessing/EShapeType.php
index 8a862fe19a1..5555671976b 100644
--- a/lib/public/TaskProcessing/EShapeType.php
+++ b/lib/public/TaskProcessing/EShapeType.php
@@ -50,6 +50,7 @@ enum EShapeType: int {
* @param mixed $value
* @return void
* @throws ValidationException
+ * @since 30.0.0
*/
private function validateNonFileType(mixed $value): void {
if ($this === EShapeType::Text && !is_string($value)) {
diff --git a/lib/public/TaskProcessing/ShapeDescriptor.php b/lib/public/TaskProcessing/ShapeDescriptor.php
index c84a638862d..6c14bab751e 100644
--- a/lib/public/TaskProcessing/ShapeDescriptor.php
+++ b/lib/public/TaskProcessing/ShapeDescriptor.php
@@ -46,6 +46,7 @@ class ShapeDescriptor implements \JsonSerializable {
/**
* @return array{name: string, description: string, type: int}
+ * @since 30.0.0
*/
public function jsonSerialize(): array {
return [