* @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);
}
abstract class AbstractLanguageModelTask implements ILanguageModelTask {
protected ?int $id = null;
protected ?string $output = null;
+
+ /**
+ * @psalm-var ILanguageModelTask::STATUS_*
+ */
protected int $status = ILanguageModelTask::STATUS_UNKNOWN;
/**
}
/**
- * @return ILanguageModelTask::STATUS_*
+ * @psalm-return ILanguageModelTask::STATUS_*
* @since 28.0.0
*/
final public function getStatus(): int {
* @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');
}