mirror of
https://github.com/won-ktds/smarketing-backend.git
synced 2025-12-06 07:06:24 +00:00
refactor: python ai api 호출 주소 변경
This commit is contained in:
parent
53a18a6eb8
commit
7537f862e9
@ -26,10 +26,10 @@ spring:
|
|||||||
|
|
||||||
external:
|
external:
|
||||||
store-service:
|
store-service:
|
||||||
base-url: ${STORE_SERVICE_URL:http://localhost:8082}
|
base-url: ${STORE_SERVICE_URL:http://smarketing.20.249.184.228.nip.io}
|
||||||
timeout: ${STORE_SERVICE_TIMEOUT:5000}
|
timeout: ${STORE_SERVICE_TIMEOUT:5000}
|
||||||
python-ai-service:
|
python-ai-service:
|
||||||
base-url: ${PYTHON_AI_SERVICE_URL:http://localhost:5001}
|
base-url: ${PYTHON_AI_SERVICE_URL:http://20.249.113.247:5001}
|
||||||
api-key: ${PYTHON_AI_API_KEY:dummy-key}
|
api-key: ${PYTHON_AI_API_KEY:dummy-key}
|
||||||
timeout: ${PYTHON_AI_TIMEOUT:30000}
|
timeout: ${PYTHON_AI_TIMEOUT:30000}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.won.smarketing.content.infrastructure.external;
|
package com.won.smarketing.content.infrastructure.external;
|
||||||
|
|
||||||
|
import com.won.smarketing.content.domain.model.store.MenuData;
|
||||||
|
import com.won.smarketing.content.domain.model.store.StoreData;
|
||||||
import com.won.smarketing.content.domain.model.store.StoreWithMenuData;
|
import com.won.smarketing.content.domain.model.store.StoreWithMenuData;
|
||||||
import com.won.smarketing.content.domain.service.AiPosterGenerator; // 도메인 인터페이스 import
|
import com.won.smarketing.content.domain.service.AiPosterGenerator; // 도메인 인터페이스 import
|
||||||
import com.won.smarketing.content.presentation.dto.PosterContentCreateRequest;
|
import com.won.smarketing.content.presentation.dto.PosterContentCreateRequest;
|
||||||
@ -12,7 +14,9 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Claude AI를 활용한 포스터 생성 구현체
|
* Claude AI를 활용한 포스터 생성 구현체
|
||||||
@ -47,12 +51,12 @@ public class PythonAiPosterGenerator implements AiPosterGenerator {
|
|||||||
// Python AI 서비스 호출
|
// Python AI 서비스 호출
|
||||||
Map<String, Object> response = webClient
|
Map<String, Object> response = webClient
|
||||||
.post()
|
.post()
|
||||||
.uri("http://localhost:5001" + "/api/ai/poster")
|
.uri(aiServiceBaseUrl + "/api/ai/poster")
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.bodyValue(requestBody)
|
.bodyValue(requestBody)
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.bodyToMono(Map.class)
|
.bodyToMono(Map.class)
|
||||||
.timeout(Duration.ofSeconds(90)) // 포스터 생성은 시간이 오래 걸릴 수 있음
|
.timeout(Duration.ofSeconds(90))
|
||||||
.block();
|
.block();
|
||||||
|
|
||||||
// 응답에서 content(이미지 URL) 추출
|
// 응답에서 content(이미지 URL) 추출
|
||||||
@ -79,6 +83,29 @@ public class PythonAiPosterGenerator implements AiPosterGenerator {
|
|||||||
private Map<String, Object> buildRequestBody(PosterContentCreateRequest request, StoreWithMenuData storeWithMenuData) {
|
private Map<String, Object> buildRequestBody(PosterContentCreateRequest request, StoreWithMenuData storeWithMenuData) {
|
||||||
Map<String, Object> requestBody = new HashMap<>();
|
Map<String, Object> requestBody = new HashMap<>();
|
||||||
|
|
||||||
|
// TODO : 매장 정보 호출 후 request
|
||||||
|
|
||||||
|
// StoreData storeData = storeWithMenuData.getStoreData();
|
||||||
|
// List<MenuData> menuDataList = storeWithMenuData.getMenuDataList();
|
||||||
|
//
|
||||||
|
// List<Map<String, Object>> menuList = menuDataList.stream()
|
||||||
|
// .map(menu -> {
|
||||||
|
// Map<String, Object> menuMap = new HashMap<>();
|
||||||
|
// menuMap.put("menu_id", menu.getMenuId());
|
||||||
|
// menuMap.put("menu_name", menu.getMenuName());
|
||||||
|
// menuMap.put("category", menu.getCategory());
|
||||||
|
// menuMap.put("price", menu.getPrice());
|
||||||
|
// menuMap.put("description", menu.getDescription());
|
||||||
|
// return menuMap;
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// requestBody.put("store_name", storeData.getStoreName());
|
||||||
|
// requestBody.put("business_type", storeData.getBusinessType());
|
||||||
|
// requestBody.put("location", storeData.getLocation());
|
||||||
|
// requestBody.put("seat_count", storeData.getSeatCount());
|
||||||
|
// requestBody.put("menu_list", menuList);
|
||||||
|
|
||||||
// 기본 정보
|
// 기본 정보
|
||||||
requestBody.put("title", request.getTitle());
|
requestBody.put("title", request.getTitle());
|
||||||
requestBody.put("category", request.getCategory());
|
requestBody.put("category", request.getCategory());
|
||||||
|
|||||||
@ -37,6 +37,10 @@ logging:
|
|||||||
external:
|
external:
|
||||||
ai-service:
|
ai-service:
|
||||||
base-url: ${AI_SERVICE_BASE_URL:http://20.249.113.247:5001}
|
base-url: ${AI_SERVICE_BASE_URL:http://20.249.113.247:5001}
|
||||||
|
store-service:
|
||||||
|
base-url: ${STORE_SERVICE_URL:http://smarketing.20.249.184.228.nip.io}
|
||||||
|
timeout: ${STORE_SERVICE_TIMEOUT:5000}
|
||||||
|
|
||||||
azure:
|
azure:
|
||||||
storage:
|
storage:
|
||||||
account-name: ${AZURE_STORAGE_ACCOUNT_NAME:stdigitalgarage02}
|
account-name: ${AZURE_STORAGE_ACCOUNT_NAME:stdigitalgarage02}
|
||||||
|
|||||||
@ -54,8 +54,5 @@ info:
|
|||||||
name: ${APP_NAME:smarketing-member}
|
name: ${APP_NAME:smarketing-member}
|
||||||
version: "1.0.0-MVP"
|
version: "1.0.0-MVP"
|
||||||
description: "AI 마케팅 서비스 MVP - member"
|
description: "AI 마케팅 서비스 MVP - member"
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
allowed-origins: ${ALLOWED_ORIGINS:http://localhost:3000}
|
allowed-origins: ${ALLOWED_ORIGINS:http://localhost:3000}
|
||||||
>>>>>>> 2c1833ebe1d6be0746597e960dc5217605b2f867
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user