mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
LLM OCP API: Avoid using OC in OCP
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
(cherry picked from commit 8f1a4f4255)
This commit is contained in:
parent
413a4f63ee
commit
5e86054858
3 changed files with 10 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue