mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 08:25:56 -04:00
Merge pull request #56391 from nextcloud/backport/56350/stable29
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled
[stable29] Add AI input limits
This commit is contained in:
commit
bc84a7f8dd
3 changed files with 9 additions and 0 deletions
|
|
@ -117,6 +117,9 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController {
|
|||
#[AnonRateLimit(limit: 5, period: 120)]
|
||||
#[ApiRoute(verb: 'POST', url: '/schedule', root: '/textprocessing')]
|
||||
public function schedule(string $input, string $type, string $appId, string $identifier = ''): DataResponse {
|
||||
if (strlen($input) > 64_000) {
|
||||
return new DataResponse(['message' => $this->l->t('Input text is too long')], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
try {
|
||||
$task = new Task($type, $input, $appId, $this->userId, $identifier);
|
||||
} catch (InvalidArgumentException) {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
|
|||
#[UserRateLimit(limit: 20, period: 120)]
|
||||
#[ApiRoute(verb: 'POST', url: '/schedule', root: '/text2image')]
|
||||
public function schedule(string $input, string $appId, string $identifier = '', int $numberOfImages = 8): DataResponse {
|
||||
if (strlen($input) > 64_000) {
|
||||
return new DataResponse(['message' => $this->l->t('Input text is too long')], Http::STATUS_PRECONDITION_FAILED);
|
||||
}
|
||||
$task = new Task($input, $appId, $numberOfImages, $this->userId, $identifier);
|
||||
try {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ class TranslationApiController extends \OCP\AppFramework\OCSController {
|
|||
*/
|
||||
#[ApiRoute(verb: 'POST', url: '/translate', root: '/translation')]
|
||||
public function translate(string $text, ?string $fromLanguage, string $toLanguage): DataResponse {
|
||||
if (strlen($text) > 64_000) {
|
||||
return new DataResponse(['message' => $this->l10n->t('Input text is too long')], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
try {
|
||||
$translation = $this->translationManager->translate($text, $fromLanguage, $toLanguage);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue