You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-server/lib/public/LanguageModel/SummaryTask.php

29 lines
712 B

<?php
namespace OCP\LanguageModel;
use RuntimeException;
class SummaryTask extends AbstractLanguageModelTask {
/**
* @param ILanguageModelProvider&ISummaryProvider $provider
* @throws RuntimeException
* @return string
*/
public function visitProvider(ILanguageModelProvider $provider): string {
if (!$provider instanceof ISummaryProvider) {
throw new \RuntimeException('SummaryTask#visitProvider expects ISummaryProvider');
}
$this->setStatus(self::STATUS_RUNNING);
try {
$output = $provider->summarize($this->getInput());
} catch (RuntimeException $e) {
$this->setStatus(self::STATUS_FAILED);
throw $e;
}
$this->setStatus(self::STATUS_SUCCESSFUL);
return $output;
}
}