Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public GptController(RestTemplate restTemplate, GptConfig gptConfig, ProductServ


// GPT 모델의 입력 토큰 제한 (예: 출력 토큰 고려 후 설정, 여기서는 예시로 25000)
private static final int GPT_INPUT_LIMIT = 12000;
private static final int GPT_INPUT_LIMIT = 11000;

/**
* 파일의 아랫부분부터 토큰을 센 후, 총 토큰 수가 GPT_INPUT_LIMIT 이하인 내용만
Expand Down Expand Up @@ -381,4 +381,4 @@ private String extractKeywordsAndReasonsSeasonalWoman(String theme, String messa

return generateText(prompt);
}
}
}
24 changes: 17 additions & 7 deletions src/main/java/com/team4/giftidea/controller/ProxyController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.team4.giftidea.controller;

import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
Expand All @@ -8,11 +10,19 @@
@RequestMapping("/api/proxy")
public class ProxyController {

private final RestTemplate restTemplate = new RestTemplate();
private final RestTemplate restTemplate = new RestTemplate();

@GetMapping("/kream")
public ResponseEntity<String> proxyToKream(@RequestParam String url) {
String response = restTemplate.getForObject(url, String.class);
return ResponseEntity.ok(response);
}
}
@GetMapping("/kream")
public ResponseEntity<byte[]> proxyToKream(@RequestParam String url) {
// 이미지의 바이트 배열을 가져옵니다.
byte[] imageBytes = restTemplate.getForObject(url, byte[].class);

// Content-Type을 적절히 설정 (필요에 따라 "image/jpeg" 또는 "image/png" 등으로 조정)
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.IMAGE_JPEG);

return ResponseEntity.ok()
.headers(headers)
.body(imageBytes);
}
}
Loading