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:
|
||||
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}
|
||||
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}
|
||||
timeout: ${PYTHON_AI_TIMEOUT:30000}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
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.service.AiPosterGenerator; // 도메인 인터페이스 import
|
||||
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.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Claude AI를 활용한 포스터 생성 구현체
|
||||
@ -47,12 +51,12 @@ public class PythonAiPosterGenerator implements AiPosterGenerator {
|
||||
// Python AI 서비스 호출
|
||||
Map<String, Object> response = webClient
|
||||
.post()
|
||||
.uri("http://localhost:5001" + "/api/ai/poster")
|
||||
.uri(aiServiceBaseUrl + "/api/ai/poster")
|
||||
.header("Content-Type", "application/json")
|
||||
.bodyValue(requestBody)
|
||||
.retrieve()
|
||||
.bodyToMono(Map.class)
|
||||
.timeout(Duration.ofSeconds(90)) // 포스터 생성은 시간이 오래 걸릴 수 있음
|
||||
.timeout(Duration.ofSeconds(90))
|
||||
.block();
|
||||
|
||||
// 응답에서 content(이미지 URL) 추출
|
||||
@ -79,6 +83,29 @@ public class PythonAiPosterGenerator implements AiPosterGenerator {
|
||||
private Map<String, Object> buildRequestBody(PosterContentCreateRequest request, StoreWithMenuData storeWithMenuData) {
|
||||
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("category", request.getCategory());
|
||||
|
||||
@ -37,6 +37,10 @@ logging:
|
||||
external:
|
||||
ai-service:
|
||||
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:
|
||||
storage:
|
||||
account-name: ${AZURE_STORAGE_ACCOUNT_NAME:stdigitalgarage02}
|
||||
|
||||
@ -54,8 +54,5 @@ info:
|
||||
name: ${APP_NAME:smarketing-member}
|
||||
version: "1.0.0-MVP"
|
||||
description: "AI 마케팅 서비스 MVP - member"
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
allowed-origins: ${ALLOWED_ORIGINS:http://localhost:3000}
|
||||
>>>>>>> 2c1833ebe1d6be0746597e960dc5217605b2f867
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user