From 4a6ef37fad732a938486fcf97ebfc1a1b405e56b Mon Sep 17 00:00:00 2001 From: gituser Date: Tue, 20 Oct 2026 20:18:19 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=84=EA=B0=9C=EB=B0=9C=20=EB=A9=B4?= =?UTF-8?q?=EC=A0=91=EC=9D=98=20=EC=8B=9C=EC=8A=A4=ED=85=9C=20=ED=94=84?= =?UTF-8?q?=EB=A1=AC=ED=94=84=ED=8A=B8=20=EC=A7=81=EB=AC=B4=EB=A5=BC=20?= =?UTF-8?q?=EC=84=B8=EC=85=98=20=EC=A7=81=EB=AC=B4=EB=A1=9C=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=95=20(#54)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 다대일 HR·CEO 면접관은 전공이 없어 비개발 면접에서도 "개발자 기술 면접" 문장이 나갔다. 세션 직무(interviewMajor)가 있으면 그것으로 정하고, 없을 때만 면접관 전공을 쓴다. Co-Authored-By: Claude Opus 5.5 --- .../service/impl/AiQuestionClientImpl.java | 3 +- .../impl/AiQuestionClientImplTest.java | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/person/repit/interview/service/impl/AiQuestionClientImpl.java b/src/main/java/com/person/repit/interview/service/impl/AiQuestionClientImpl.java index c94cbbb..ed82915 100644 --- a/src/main/java/com/person/repit/interview/service/impl/AiQuestionClientImpl.java +++ b/src/main/java/com/person/repit/interview/service/impl/AiQuestionClientImpl.java @@ -137,7 +137,8 @@ private Map createRequestBody(FollowQuestionAiRequest request) { } private InterviewMajor systemMajor(FollowQuestionAiRequest request) { - if (isGeneralInterview(request)) { + // 시스템 프롬프트는 면접 전체의 직무로 정한다. HR·CEO처럼 전공이 없는 면접관 차례에도 같은 직무 면접이다. + if (request.getInterviewMajor() != null) { return request.getInterviewMajor(); } return request.getMajor() != null && request.getMajor().isGeneral() ? null : request.getMajor(); diff --git a/src/test/java/com/person/repit/interview/service/impl/AiQuestionClientImplTest.java b/src/test/java/com/person/repit/interview/service/impl/AiQuestionClientImplTest.java index 326f50c..59895d7 100644 --- a/src/test/java/com/person/repit/interview/service/impl/AiQuestionClientImplTest.java +++ b/src/test/java/com/person/repit/interview/service/impl/AiQuestionClientImplTest.java @@ -135,6 +135,37 @@ class AiQuestionClientImplTest { : "직무 판단의 근거와 대안, 본인이 한 일을 확인하세요."); } + @ParameterizedTest + @org.junit.jupiter.params.provider.EnumSource(value = InterviewRole.class, names = {"HR", "CEO"}) + void 비개발_면접은_전공_없는_면접관_차례에도_세션_직무로_시스템_프롬프트를_정한다(InterviewRole role) { + FollowQuestionAiRequest request = sessionRequest(InterviewMajor.QA_ENGINEER, null, role); + Map body = ReflectionTestUtils.invokeMethod(client(), "createRequestBody", request); + assertThat((String) body.get("system")).startsWith("당신은 QA 엔지니어 직무 면접에서"); + } + + @Test + void 개발_면접의_HR_차례는_개발자_기술_면접을_유지한다() throws Exception { + FollowQuestionAiRequest request = sessionRequest(InterviewMajor.BACKEND, null, InterviewRole.HR); + Map body = ReflectionTestUtils.invokeMethod(client(), "createRequestBody", request); + assertThat(body.get("system")).isEqualTo(originalPrompt("system")); + } + + @Test + void 세션_직무가_없으면_면접관_전공으로_시스템_프롬프트를_정한다() throws Exception { + FollowQuestionAiRequest request = sessionRequest(null, InterviewMajor.QA_ENGINEER, InterviewRole.TECH); + Map body = ReflectionTestUtils.invokeMethod(client(), "createRequestBody", request); + assertThat(body.get("system")).isEqualTo(jobPrompt("nondev-qa-system")); + } + + private FollowQuestionAiRequest sessionRequest(InterviewMajor session, InterviewMajor persona, InterviewRole role) { + return FollowQuestionAiRequest.builder().sessionId("session-id") + .interviewId(1L).userId(2L).personaId(3L) + .personality(InterviewType.FRIENDLY).tone(InterviewTone.GENTLE) + .major(persona).interviewMajor(session).level(InterviewLevel.NORMAL).role(role) + .questionId(4L).questionCategory("tech_choice").questionContent("질문") + .expectedAnswer("참고 답안").answerContent("답변").responseTime(10).build(); + } + private FollowQuestionAiRequest jobRequest(InterviewMajor major, InterviewRole role) { return FollowQuestionAiRequest.builder().sessionId("session-id") .interviewId(1L).userId(2L).personaId(3L)