dev add google search by image
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-01-27 05:41:47 +07:00
parent e7c6df12d6
commit 21e31c7d0f
6 changed files with 318 additions and 1 deletions
@@ -3,13 +3,14 @@ package ru.soune.nocopy.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.soune.nocopy.dto.BaseRequest;
import ru.soune.nocopy.dto.BaseResponse;
import ru.soune.nocopy.dto.MessageCode;
import ru.soune.nocopy.dto.file.GoogleVisionSearchResponse;
import ru.soune.nocopy.dto.file.ImageSearchRequest;
import ru.soune.nocopy.dto.file.YandexSearchResponse;
import ru.soune.nocopy.service.GoogleVisionSearchService;
import ru.soune.nocopy.service.YandexSearchService;
@Slf4j
@@ -21,6 +22,8 @@ public class ImageFoundRequestHandler implements RequestHandler {
private final YandexSearchService yandexSearchService;
private final GoogleVisionSearchService googleVisionSearchService;
@Override
public BaseResponse handle(BaseRequest request) throws Exception {
ImageSearchRequest imageSearchRequest = objectMapper.convertValue(request.getMessageBody(),
@@ -30,6 +33,9 @@ public class ImageFoundRequestHandler implements RequestHandler {
YandexSearchResponse response = yandexSearchService.searchByFileEntity(fileId);
//TODO uncommited when add billing
// GoogleVisionSearchResponse googleVisionSearchResponse = googleVisionSearchService.searchByFileEntity(fileId);
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
MessageCode.SUCCESS.getDescription(), response);
}