feat: translation codes
This commit is contained in:
@@ -43,7 +43,7 @@ class ContentModerationService
|
||||
$apiKey = trim((string) config('moderation.content.openai_key'));
|
||||
|
||||
if ($apiKey === '') {
|
||||
throw new HttpException(503, __('api.moderation.unavailable'));
|
||||
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE');
|
||||
}
|
||||
|
||||
$input = [];
|
||||
@@ -80,7 +80,7 @@ class ContentModerationService
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
throw new HttpException(503, __('api.moderation.unavailable'), $exception);
|
||||
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE', $exception);
|
||||
}
|
||||
|
||||
if (collect($response->json('results', []))->contains(
|
||||
@@ -107,7 +107,7 @@ class ContentModerationService
|
||||
$contents = file_get_contents($image->getRealPath());
|
||||
|
||||
if ($contents === false) {
|
||||
throw new HttpException(503, __('api.moderation.unavailable'));
|
||||
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE');
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
@@ -126,7 +126,7 @@ class ContentModerationService
|
||||
private function rejectContent(): never
|
||||
{
|
||||
throw ValidationException::withMessages([
|
||||
'content' => [__('api.moderation.rejected')],
|
||||
'content' => ['CONTENT_MODERATION_REJECTED'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user