dev add utf encoding
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-10 13:26:44 +07:00
parent 90be1d9d2b
commit 86f7fc593a
3 changed files with 114 additions and 62 deletions
@@ -18,7 +18,10 @@ import ru.soune.nocopy.service.search.GoogleVisionSearchService;
import ru.soune.nocopy.service.tariff.TariffConstants;
import ru.soune.nocopy.service.tariff.TariffInfoService;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
@Slf4j
@Component
@@ -58,7 +61,24 @@ public class ImageFoundRequestHandler implements RequestHandler {
//TODO uncommited when add billing
// GoogleVisionSearchResponse googleVisionSearchResponse = googleVisionSearchService.searchByFileEntity(fileId);
String yandexReverseSearchResponse = yandexSearchService.searchReverseByPublicUrl(fileEntity);
String yandexReverseSearchResponse;
try {
yandexReverseSearchResponse = yandexSearchService.searchReverseByPublicUrlWithTimeout(fileEntity, 20);
} catch (TimeoutException e) {
log.warn("Search timeout for file {}, returning empty results", fileId);
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
"Search completed (partial)", Map.of(
"results", List.of(),
"total", 0,
"searchStatus", "timeout"
));
} catch (IOException e) {
log.error("Search failed for file {}", fileId, e);
return new BaseResponse(request.getMsgId(), 20007,
"Search service temporarily unavailable",
Map.of("fileId", fileId));
}
int page = imageSearchRequest.getPage() != null ? imageSearchRequest.getPage() : 1;
int pageSize = imageSearchRequest.getPageSize() != null ? imageSearchRequest.getPageSize() : 10;