Skip to content

[Fix/#235] 2차 과제 피드백 적용 - #236

Merged
kimkimgungunwoo merged 1 commit into
developfrom
fix/#235
Aug 6, 2026
Merged

[Fix/#235] 2차 과제 피드백 적용#236
kimkimgungunwoo merged 1 commit into
developfrom
fix/#235

Conversation

@kimkimgungunwoo

Copy link
Copy Markdown
Contributor

📌 관련 이슈번호

(Closes 키워드가 있어야 PR이 머지되었을 때 이슈가 자동으로 닫힌다)

📌 PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • 리팩토링

📌 PR 요약

해당 PR을 간단하게 요약해 주세요

📌 작업 세부 내용

📸 스크린샷 (선택)

🔗 참고 자료

@kimkimgungunwoo kimkimgungunwoo self-assigned this Aug 6, 2026
@kimkimgungunwoo kimkimgungunwoo linked an issue Aug 6, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

AI 질문 재생성 및 질문-일기 연결 API를 제거했습니다. Gemini의 빈 응답과 JSON 파싱 오류를 명시적 예외로 처리했습니다. 관련 AI API의 Swagger 500 응답 문서를 오류 코드별 예시로 확장했습니다.

Changes

AI API 및 오류 처리

Layer / File(s) Summary
질문 API 및 DTO 제거
src/ai/ai.controller.ts, src/ai/ai.swagger.ts, src/ai/dto/ai-diary-question.dto.ts, src/ai/services/ai-question.service.ts
오늘의 질문 재생성 API와 질문-일기 연결 API를 제거했습니다. 관련 DTO와 테스트용 재생성 메서드도 삭제했습니다.
Gemini 응답 오류 처리
src/ai/services/ai-gemini.service.ts
빈 텍스트 응답을 AI_EMPTY_RESPONSE로 처리했습니다. JSON 파싱 실패를 AI_RESPONSE_PARSE_ERROR로 처리했습니다. 질문, 답변, 일정 추천 생성에 공통 처리를 적용했습니다.
AI 오류 응답 문서화
src/ai/ai.swagger.ts
오늘의 질문, AI 답변, AI 일정 추천 API의 500 응답에 오류 코드별 JSON 예시를 추가했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • TEAM-DAILOG/BE#27: AI 질문-일기 연결 API와 DiaryQuestionEntity 및 DTO 변경에서 직접 연결됩니다.
  • TEAM-DAILOG/BE#64: QuestionServiceregenerateTodayQuestion 기능과 일일 질문 생성을 함께 다룹니다.
  • TEAM-DAILOG/BE#223: AI 추천 처리와 AiController, Swagger 문서, GeminiService를 함께 수정합니다.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive 이슈 #235에 구체적인 오류, 해결 방안 또는 완료 조건이 없어 코드 변경이 요구사항을 충족하는지 확인할 수 없습니다. 이슈 #235에 제거할 API와 예외 처리 개선 등 구체적인 요구사항과 완료 조건을 추가하세요.
Out of Scope Changes check ❓ Inconclusive 이슈 #235의 범위가 구체적이지 않아 AI API 제거와 Gemini 예외 처리 변경이 범위 내인지 판단할 수 없습니다. 이슈 #235에 작업 범위를 명시하고 각 변경 사항이 해당 범위에 포함되는지 연결하세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 이슈와 변경 목적을 나타내며, AI API 정리와 예외 처리 개선을 포함한 피드백 적용 작업과 관련됩니다.
Description check ✅ Passed 설명은 연결된 이슈와 버그 수정 및 리팩토링 유형을 명시하여 변경 사항과 관련됩니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#235

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/ai/services/ai-gemini.service.ts`:
- Around line 33-41: Update requireAiText to trim the received text before
validating it, throw InternalServerException with AI_EMPTY_RESPONSE when the
trimmed value is empty, and return the trimmed value so generateTodayQuestion
and generateAnswer handle whitespace-only responses consistently.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f5622b6-2da5-43a5-8532-ec5c933ca267

📥 Commits

Reviewing files that changed from the base of the PR and between 79e6d8e and 26e2b9e.

📒 Files selected for processing (5)
  • src/ai/ai.controller.ts
  • src/ai/ai.swagger.ts
  • src/ai/dto/ai-diary-question.dto.ts
  • src/ai/services/ai-gemini.service.ts
  • src/ai/services/ai-question.service.ts
💤 Files with no reviewable changes (1)
  • src/ai/dto/ai-diary-question.dto.ts

Comment on lines +33 to +41
function requireAiText(text: string | undefined): string {
if (!text) {
throw new InternalServerException(
'AI가 빈 응답을 반환했습니다.',
'AI_EMPTY_RESPONSE',
);
}

return text;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

공백 전용 AI 응답도 AI_EMPTY_RESPONSE로 처리하세요.

" ""\n"은 truthy입니다. 따라서 generateTodayQuestiongenerateAnswer.trim() 후 빈 문자열을 성공 값으로 반환합니다. 추천 API는 같은 입력을 AI_RESPONSE_PARSE_ERROR로 반환합니다.

requireAiText에서 먼저 trim()한 값을 검사하고 반환하세요.

수정 예시
 function requireAiText(text: string | undefined): string {
-  if (!text) {
+  const normalizedText = text?.trim();
+
+  if (!normalizedText) {
     throw new InternalServerException(
       'AI가 빈 응답을 반환했습니다.',
       'AI_EMPTY_RESPONSE',
     );
   }
 
-  return text;
+  return normalizedText;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function requireAiText(text: string | undefined): string {
if (!text) {
throw new InternalServerException(
'AI가 빈 응답을 반환했습니다.',
'AI_EMPTY_RESPONSE',
);
}
return text;
function requireAiText(text: string | undefined): string {
const normalizedText = text?.trim();
if (!normalizedText) {
throw new InternalServerException(
'AI가 빈 응답을 반환했습니다.',
'AI_EMPTY_RESPONSE',
);
}
return normalizedText;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/ai/services/ai-gemini.service.ts` around lines 33 - 41, Update
requireAiText to trim the received text before validating it, throw
InternalServerException with AI_EMPTY_RESPONSE when the trimmed value is empty,
and return the trimmed value so generateTodayQuestion and generateAnswer handle
whitespace-only responses consistently.

@kimkimgungunwoo
kimkimgungunwoo merged commit fd8b8eb into develop Aug 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 2차과제 피드백 적용

1 participant