diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-07-07 11:50:01 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-08-09 10:02:14 +0200 |
commit | 5e8605485861081d9cc8e2ebe2f8a0b53c8e6730 (patch) | |
tree | a1df9a828149dec2b453d7fd0256ac3362a54ca8 /lib | |
parent | 413a4f63ee69bb6419076a702c7187fbc44a9bf1 (diff) | |
download | nextcloud-server-5e8605485861081d9cc8e2ebe2f8a0b53c8e6730.tar.gz nextcloud-server-5e8605485861081d9cc8e2ebe2f8a0b53c8e6730.zip |
LLM OCP API: Avoid using OC in OCP
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
(cherry picked from commit 8f1a4f42557302c7d1c97be0439c47e59133955a)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/LanguageModel/Db/Task.php | 9 | ||||
-rw-r--r-- | lib/private/LanguageModel/LanguageModelManager.php | 2 | ||||
-rw-r--r-- | lib/public/LanguageModel/AbstractLanguageModelTask.php | 16 |
3 files changed, 10 insertions, 17 deletions
diff --git a/lib/private/LanguageModel/Db/Task.php b/lib/private/LanguageModel/Db/Task.php index 8eb71b0ea57..4e46f19e8a9 100644 --- a/lib/private/LanguageModel/Db/Task.php +++ b/lib/private/LanguageModel/Db/Task.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OC\LanguageModel\Db; use OCP\AppFramework\Db\Entity; +use OCP\LanguageModel\AbstractLanguageModelTask; use OCP\LanguageModel\ILanguageModelTask; /** @@ -101,4 +102,12 @@ class Task extends Entity { ]); return $task; } + + public function toLanguageModelTask(): ILanguageModelTask { + $task = AbstractLanguageModelTask::factory($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier()); + $task->setId($this->getId()); + $task->setStatus($this->getStatus()); + $task->setOutput($this->getOutput()); + return $task; + } } diff --git a/lib/private/LanguageModel/LanguageModelManager.php b/lib/private/LanguageModel/LanguageModelManager.php index c195669acb4..c956dfc64ab 100644 --- a/lib/private/LanguageModel/LanguageModelManager.php +++ b/lib/private/LanguageModel/LanguageModelManager.php @@ -201,7 +201,7 @@ class LanguageModelManager implements ILanguageModelManager { public function getTask(int $id): ILanguageModelTask { try { $taskEntity = $this->taskMapper->find($id); - return AbstractLanguageModelTask::fromTaskEntity($taskEntity); + return $taskEntity->toLanguageModelTask(); } catch (DoesNotExistException $e) { throw new NotFoundException('Could not find task with the provided id'); } catch (MultipleObjectsReturnedException $e) { diff --git a/lib/public/LanguageModel/AbstractLanguageModelTask.php b/lib/public/LanguageModel/AbstractLanguageModelTask.php index 884f26e1457..2b92e6f115d 100644 --- a/lib/public/LanguageModel/AbstractLanguageModelTask.php +++ b/lib/public/LanguageModel/AbstractLanguageModelTask.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace OCP\LanguageModel; -use OC\LanguageModel\Db\Task; - /** * This is an abstract LanguageModel task that implements basic * goodies for downstream tasks @@ -161,20 +159,6 @@ abstract class AbstractLanguageModelTask implements ILanguageModelTask { ]; } - - /** - * @param Task $taskEntity - * @return ILanguageModelTask - * @since 28.0.0 - */ - final public static function fromTaskEntity(Task $taskEntity): ILanguageModelTask { - $task = self::factory($taskEntity->getType(), $taskEntity->getInput(), $taskEntity->getuserId(), $taskEntity->getAppId(), $taskEntity->getIdentifier()); - $task->setId($taskEntity->getId()); - $task->setStatus($taskEntity->getStatus()); - $task->setOutput($taskEntity->getOutput()); - return $task; - } - /** * @param string $type * @param string $input |