fix AI moderation response mapping and long post text

The AI service returns snake_case JSON, so detectedLabels was always null
and blocked posts carried no labels. Map it with @JsonProperty("detected_labels").

Post text longer than the service limit (5000 chars) got 422, which became
AiBadRequestException and the post was rejected. Text is now sent in
overlapping chunks within ai.text-max-length; blank text is skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-20 00:33:31 +03:00
parent d63a3309fa
commit a68b89981c
7 changed files with 310 additions and 7 deletions

View File

@@ -50,6 +50,8 @@ ai:
url: ${AI_SERVICE_URL:http://localhost:8000}
timeout: 10
image-timeout: ${AI_IMAGE_TIMEOUT:30}
# Должно совпадать с TEXT_MAX_LENGTH AI-сервиса; длиннее — отправляется частями
text-max-length: ${AI_TEXT_MAX_LENGTH:5000}
retry:
max-attempts: 3
delay: 500