Skip to content

Commit

Permalink
LLM OCP API: Fix psam errors
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jul 7, 2023
1 parent f7e1e79 commit d6d4e0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/Controller/LanguageModelApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function tasks(): DataResponse {
* @UserRateThrottle(limit=20, period=120)
* @AnonRateThrottle(limit=5, period=120)
*/
public function schedule(string $text, string $type, ?string $appId): DataResponse {
public function schedule(string $text, string $type, ?string $appId, string $identifier = ''): DataResponse {
try {
$task = AbstractLanguageModelTask::factory($type, $text, $this->userId, $appId);
$task = AbstractLanguageModelTask::factory($type, $text, $this->userId, $appId, $identifier);
} catch (InvalidArgumentException $e) {
return new DataResponse(['message' => $this->l->t('Requested task type does not exist')], Http::STATUS_BAD_REQUEST);
}
Expand Down
8 changes: 6 additions & 2 deletions lib/public/LanguageModel/AbstractLanguageModelTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
abstract class AbstractLanguageModelTask implements ILanguageModelTask {
protected ?int $id = null;
protected ?string $output = null;

/**
* @psalm-var ILanguageModelTask::STATUS_*
*/
protected int $status = ILanguageModelTask::STATUS_UNKNOWN;

/**
Expand Down Expand Up @@ -77,7 +81,7 @@ final public function setOutput(?string $output): void {
}

/**
* @return ILanguageModelTask::STATUS_*
* @psalm-return ILanguageModelTask::STATUS_*
* @since 28.0.0
*/
final public function getStatus(): int {
Expand Down Expand Up @@ -181,7 +185,7 @@ final public static function fromTaskEntity(Task $taskEntity): ILanguageModelTas
* @throws \InvalidArgumentException
* @since 28.0.0
*/
final public static function factory(string $type, string $input, ?string $userId, string $appId, string $identifier): ILanguageModelTask {
final public static function factory(string $type, string $input, ?string $userId, string $appId, string $identifier = ''): ILanguageModelTask {
if (!in_array($type, array_keys(self::TYPES))) {
throw new \InvalidArgumentException('Unknown task type');
}
Expand Down

0 comments on commit d6d4e0f

Please sign in to comment.