You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class TextToImageProvider implements ISynchronousWatermarkingProvider {
26
27
@@ -110,19 +111,29 @@ public function process(?string $userId, array $input, callable $reportProgress,
110
111
$startTime = time();
111
112
112
113
if (!isset($input['input']) || !is_string($input['input'])) {
113
-
thrownewRuntimeException('Invalid prompt');
114
+
thrownewProcessingException('Invalid prompt');
114
115
}
115
116
$prompt = $input['input'];
116
117
117
118
$nbImages = 1;
118
119
if (isset($input['numberOfImages']) && is_int($input['numberOfImages'])) {
119
120
$nbImages = $input['numberOfImages'];
120
121
}
122
+
if ($nbImages > 12) {
123
+
thrownewUserFacingProcessingException('numberOfImages is out of bounds', userFacingMessage: $this->l->t('Cannot generate more than 12 images at once'));
124
+
}
125
+
if ($nbImages < 1) {
126
+
thrownewUserFacingProcessingException('numberOfImages is out of bounds', userFacingMessage: $this->l->t('Cannot generate less than 1 image'));
0 commit comments