Skip to content

Conversation

@nurdy-kim
Copy link
Contributor

@nurdy-kim nurdy-kim commented Oct 26, 2025

작업 사항

JIRA TICKET: #GOMO-39


내용

  • Quest Generator Python -> Spring boot 통합 작업

@nurdy-kim nurdy-kim self-assigned this Oct 26, 2025
@nurdy-kim nurdy-kim added the enhancement New feature or request label Oct 26, 2025
Copy link
Contributor

@jhl221123 jhl221123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

@RequiredArgsConstructor
class GeminiGenerateTextUseCase implements GenerateTextPortIn {

private final GeminiApiAdapter geminiApiAdapter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헥사고날 도입을 결정한 만큼, application service가 adapter를 직접 의존하는 것은 피하면 좋을 것 같습니다!

  1. application 패키지 내, outbound-port 를 정의
  2. GeminiGenerateTextUseCase는 outbound-port 의존
  3. infrastructure/adapter/GeminiApiAdapter가 outbound-port 구현


return objectMapper.readValue(cleanText, typeRef);
} catch (JsonProcessingException e){
throw new GenerateQuestException(GenerateQuestErrorCode.INVALID_JSON_FORMAT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quest content 뿐만 아닌 모든 llm 생성 데이터에 공통으로 해당되는 "예외"라면, 예외 이름을 변경하는 것이 좋을 것 같습니다. 만약 Quest content에만 해당되는 "규칙" 이라면, quest 모듈에서 검증해야하는 책임이라 생각합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 코드에서 사용된 Exception은 Gemini 응답과정에서 발생하는 JSON Parsing문제 등 이므로 변경된 LlmException와 LlmErrorCode로 변경하였습니다.

}
}

private GeminiRequest createGeminiRequest(GenerateTextCommand command) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 클래스는 llm 호출과 응답 반환에 대한 책임만 가지는 것이 이상적이라 생각합니다.
무엇을 받고, 무엇을 생성하는지 구체적으로 알게 되면 확장성과 유지 보수성이 떨어질 것이라 생각합니다.

application 계층에서 요청에 적합한 프롬프트를 가공하고, llm 이 생성한 응답을 필요에 따라 파싱하면 조금 더 응집도가 높은 코드가 될 것 같습니다. 현재 driving, driven port 모두 GenerateTextCommand를 사용하고 있는데, 이것도 분리가 필요하겠군요!

import com.gomo.app.support.llm.util.PromptLoader;
import com.gomo.app.core.quest.domain.model.quest.QuestType;

public record GeminiRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini 요청할 때만 필요한 레코드라면, GeminiClient 내부에서 중첩으로 관리하는 것도 고려해보면 좋을 것 같습니다!

* @param object: API response object specification string( normally: "chat.completion")
* @param usage: Total Usage.
*/
public record GeminiResponse(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요청 레코드와 마찬가지 입니다!

jhl221123 and others added 8 commits December 14, 2025 21:55
* fix: api 문서 수정

* fix: final 키워드 추가

* refactor: 테스트 이름 수정

* fix: http method 수정
fix: 회원 조회 시, 위젯도 함께 조회하도록 수정
* refactor: 전체 모듈 헥사고날 아키텍처로 전환

* refactor: 관심사 도메인 서비스 리팩터링

* refacter: 인증 코드, 인증 토큰 검증 기능 인증 모듈로 이동

* fix: 인증 코드 검증 api http method GET -> POST 수정

* refactor: 인증 모듈을 core 하위로 이동

* fix: OAuth 가입 시, 인증 토큰을 검증하지 않도록 수정
- AuthInfo를 SessionInfo로 변경
- 인증 정보를 주입하는 resolver를 공통 세션 모듈로 이전
* refactor: 비밀번호 초기화 기능 수정

- 임시 토큰 검증에 대한 책임은 인증 모듈로 이동
- 인증 모듈과 회원 모듈 간 순환 의존 제거

* feat: 스프링 모듈리스 도입

- 모듈간 순환 의존성 검증 자동화
- 모듈간 의존 방향 문서화

* docs: 문서 제목 수정

* fix: support-logging 모듈 패키지 공개 타입 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants