From 8d97d7f80e544bbf62a826108da50fe63dc51d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=83=9C=EC=A7=84?= <140797244+taejinn@users.noreply.github.com> Date: Wed, 19 Aug 2026 23:32:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20AI=20?= =?UTF-8?q?=EC=9A=94=EC=95=BD=20Upstage=20=EB=B9=88=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#2330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/UpstageArticleSummaryClient.java | 16 ++++++++++++---- .../client/UpstageArticleSummaryClientTest.java | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClient.java b/src/main/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClient.java index 6c46f2f06..925be54bd 100644 --- a/src/main/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClient.java +++ b/src/main/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClient.java @@ -93,7 +93,6 @@ private Map requestBody(ArticleSummaryPrompt prompt) { ), "temperature", 0.2, "top_p", 0.9, - "max_tokens", 500, "reasoning_effort", "low", "response_format", responseFormat(prompt.maxItems()) ); @@ -143,9 +142,17 @@ private String extractContent(ChatCompletionResponse response) { if (response == null || response.choices() == null || response.choices().isEmpty()) { throw new ArticleSummaryExternalApiException("Upstage 요약 응답이 비어 있습니다.", true, null); } - String content = response.choices().get(0).message().content(); + Choice choice = response.choices().get(0); + String content = choice.message() == null ? null : choice.message().content(); if (!StringUtils.hasText(content)) { - throw new ArticleSummaryExternalApiException("Upstage 요약 본문이 비어 있습니다.", true, null); + String finishReason = StringUtils.hasText(choice.finishReason()) + ? " finish_reason=%s".formatted(choice.finishReason()) + : ""; + throw new ArticleSummaryExternalApiException( + "Upstage 요약 본문이 비어 있습니다." + finishReason, + true, + null + ); } return content; } @@ -219,7 +226,8 @@ private record ChatCompletionResponse( @JsonIgnoreProperties(ignoreUnknown = true) private record Choice( - Message message + Message message, + @JsonProperty("finish_reason") String finishReason ) { } diff --git a/src/test/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClientTest.java b/src/test/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClientTest.java index bf7780172..43a4bb949 100644 --- a/src/test/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClientTest.java +++ b/src/test/java/in/koreatech/koin/infrastructure/upstage/client/UpstageArticleSummaryClientTest.java @@ -33,6 +33,8 @@ class UpstageArticleSummaryClientTest { assertThat(requestBody) .containsEntry("model", "solar-pro4") - .containsKey("response_format"); + .containsEntry("reasoning_effort", "low") + .containsKey("response_format") + .doesNotContainKey("max_tokens"); } } From 5dbe0760bbf80b19d973132fbd352405b28b3957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=83=9C=EC=A7=84?= <140797244+taejinn@users.noreply.github.com> Date: Wed, 19 Aug 2026 23:48:26 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20AI=20?= =?UTF-8?q?=EC=9A=94=EC=95=BD=20=EC=9A=94=EC=B2=AD=20=ED=83=80=EC=9E=84?= =?UTF-8?q?=EC=95=84=EC=9B=83=EC=9D=84=2010=EB=B6=84=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=97=B0=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../article/service/summary/ArticleAiSummaryProperties.java | 2 +- src/main/resources/application.yml | 2 +- .../article/service/summary/ArticleAiSummaryPropertiesTest.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/in/koreatech/koin/domain/community/article/service/summary/ArticleAiSummaryProperties.java b/src/main/java/in/koreatech/koin/domain/community/article/service/summary/ArticleAiSummaryProperties.java index 97f3df70f..bc6bf30d1 100644 --- a/src/main/java/in/koreatech/koin/domain/community/article/service/summary/ArticleAiSummaryProperties.java +++ b/src/main/java/in/koreatech/koin/domain/community/article/service/summary/ArticleAiSummaryProperties.java @@ -32,7 +32,7 @@ public class ArticleAiSummaryProperties { private int failedRetryWindowStartHour = 0; private int failedRetryWindowEndHour = 4; private int requestTimeoutSeconds = 120; - private int chatRequestTimeoutSeconds = 120; + private int chatRequestTimeoutSeconds = 600; private int documentParseRequestTimeoutSeconds = 180; private int documentDownloadTimeoutSeconds = 60; private String model = "solar-pro4"; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3c560246c..554cfe91d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -143,7 +143,7 @@ article: failed-retry-window-start-hour: ${ARTICLE_AI_SUMMARY_FAILED_RETRY_WINDOW_START_HOUR:0} failed-retry-window-end-hour: ${ARTICLE_AI_SUMMARY_FAILED_RETRY_WINDOW_END_HOUR:4} request-timeout-seconds: ${ARTICLE_AI_SUMMARY_REQUEST_TIMEOUT_SECONDS:120} - chat-request-timeout-seconds: ${ARTICLE_AI_SUMMARY_CHAT_REQUEST_TIMEOUT_SECONDS:120} + chat-request-timeout-seconds: ${ARTICLE_AI_SUMMARY_CHAT_REQUEST_TIMEOUT_SECONDS:600} document-parse-request-timeout-seconds: ${ARTICLE_AI_SUMMARY_DOCUMENT_PARSE_REQUEST_TIMEOUT_SECONDS:180} document-download-timeout-seconds: ${ARTICLE_AI_SUMMARY_DOCUMENT_DOWNLOAD_TIMEOUT_SECONDS:60} model: ${ARTICLE_AI_SUMMARY_MODEL:solar-pro4} diff --git a/src/test/java/in/koreatech/koin/unit/domain/community/article/service/summary/ArticleAiSummaryPropertiesTest.java b/src/test/java/in/koreatech/koin/unit/domain/community/article/service/summary/ArticleAiSummaryPropertiesTest.java index bafa93f39..c38b48dbc 100644 --- a/src/test/java/in/koreatech/koin/unit/domain/community/article/service/summary/ArticleAiSummaryPropertiesTest.java +++ b/src/test/java/in/koreatech/koin/unit/domain/community/article/service/summary/ArticleAiSummaryPropertiesTest.java @@ -14,5 +14,6 @@ class ArticleAiSummaryPropertiesTest { assertThat(properties.getModel()).isEqualTo("solar-pro4"); assertThat(properties.getPromptVersion()).isEqualTo("v11"); + assertThat(properties.getChatRequestTimeoutSeconds()).isEqualTo(600); } }