fixed controllers

This commit is contained in:
SlimusMinus
2026-07-31 01:08:53 +03:00
parent 74f7c88843
commit 2468c26b84
32 changed files with 536 additions and 432 deletions

View File

@@ -19,29 +19,18 @@ public class TextModerationClient {
private final AiHttpClient client;
@Retryable(
retryFor = {
AiUnavailableException.class,
AiServerException.class
},
retryFor = {AiUnavailableException.class, AiServerException.class},
maxAttempts = 3,
backoff = @Backoff(
delay = 500,
multiplier = 2
)
backoff = @Backoff(delay = 500, multiplier = 2)
)
public ModerationResponse moderate(String text) {
log.info("Calling AI service");
return client.post(
"/api/v1/moderation/text",
new TextModerationRequest(text),
ModerationResponse.class
);
log.info("Calling AI TextModeration service");
return client.post("/api/v1/moderation/text", new TextModerationRequest(text), ModerationResponse.class);
}
@Recover
public ModerationResponse recover(AiUnavailableException e, String text) {
log.error("AI unavailable after retries", e);
log.error("AI TextModeration unavailable after retries", e);
return ModerationResponse.builder()
.approved(false)