fix(gateway): load AI API keys from application properties instead of hardcoding
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 16s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 16s
This commit is contained in:
@@ -45,6 +45,15 @@ public class ChatController {
|
||||
private final ChatClient.Builder chatClientBuilder;
|
||||
private final McpRouterController mcpRouterController;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.base-url}")
|
||||
private String liteLlmBaseUrl;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.gemma-key}")
|
||||
private String gemmaKey;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.qwen-key}")
|
||||
private String qwenKey;
|
||||
|
||||
@PostMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public SseEmitter chatStream(@RequestBody Map<String, String> request,
|
||||
@RequestHeader(value = "X-Agent-Id", required = false) String agentId,
|
||||
@@ -98,8 +107,8 @@ public class ChatController {
|
||||
// 2. 모델 분기 처리: 사내 모델(Qwen3/Gemma-4) vs 기존 외부 모델(OpenRouter 등)
|
||||
if ("Qwen3-Coder".equalsIgnoreCase(selectedModel) || "Gemma-4-31B".equalsIgnoreCase(selectedModel)) {
|
||||
// 사내 LiteLLM 환경 동적 ChatModel 생성
|
||||
String liteLlmBaseUrl = "https://dev-iam-litellm.shinhanlife.co.kr:18020";
|
||||
String apiKey = "Gemma-4-31B".equalsIgnoreCase(selectedModel) ? "sk-EH107wYBZuu6RUTqthRl7A" : "sk-UJ2IRenvaMPbY3ozQdj6zw";
|
||||
// Use liteLlmBaseUrl from application.yml
|
||||
String apiKey = "Gemma-4-31B".equalsIgnoreCase(selectedModel) ? gemmaKey : qwenKey;
|
||||
|
||||
org.springframework.ai.openai.api.OpenAiApi openAiApi = org.springframework.ai.openai.api.OpenAiApi.builder()
|
||||
.baseUrl(liteLlmBaseUrl)
|
||||
|
||||
@@ -55,6 +55,15 @@ public class ScaffoldingController {
|
||||
private final ChatClient.Builder chatClientBuilder;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.base-url}")
|
||||
private String liteLlmBaseUrl;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.gemma-key}")
|
||||
private String gemmaKey;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${shinhan.ai.qwen-key}")
|
||||
private String qwenKey;
|
||||
|
||||
public ScaffoldingController(ChatClient.Builder chatClientBuilder, ObjectMapper objectMapper) {
|
||||
this.chatClientBuilder = chatClientBuilder;
|
||||
this.objectMapper = objectMapper;
|
||||
@@ -639,8 +648,8 @@ public class ScaffoldingController {
|
||||
org.springframework.ai.chat.prompt.ChatOptions chatOptions;
|
||||
|
||||
if ("Qwen3-Coder".equalsIgnoreCase(resolvedModel) || "Gemma-4-31B".equalsIgnoreCase(resolvedModel)) {
|
||||
String liteLlmBaseUrl = "https://dev-iam-litellm.shinhanlife.co.kr:18020";
|
||||
String apiKey = "Gemma-4-31B".equalsIgnoreCase(resolvedModel) ? "sk-EH107wYBZuu6RUTqthRl7A" : "sk-UJ2IRenvaMPbY3ozQdj6zw";
|
||||
// Use liteLlmBaseUrl from application.yml
|
||||
String apiKey = "Gemma-4-31B".equalsIgnoreCase(resolvedModel) ? gemmaKey : qwenKey;
|
||||
|
||||
org.springframework.ai.openai.api.OpenAiApi openAiApi = org.springframework.ai.openai.api.OpenAiApi.builder()
|
||||
.baseUrl(liteLlmBaseUrl)
|
||||
|
||||
Reference in New Issue
Block a user