Skip to content

[ai-meal] AI 식단 생성 결과 undefined 표시 수정 - #93

Merged
g-hyxn merged 2 commits into
developfrom
fix/ai-meal-generation-polling
Jul 4, 2026
Merged

g-hyxn merged 2 commits into
developfrom
fix/ai-meal-generation-polling

Conversation

@g-hyxn

@g-hyxn g-hyxn commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

💡 PR 요약

  • AI 식단 생성 결과가 undefined건으로 표시되던 문제를 수정하였습니다. 백엔드의 비동기 작업 응답(id, status)에 맞게 상태를 폴링하고, 완료 후 실제 식단 수를 집계해 표시하도록 변경하였습니다.

📋 작업 내용

  • POST /meals/ai-generations 응답 타입을 실제 스펙(AiGenerationResponse { id, status })에 맞게 수정하였습니다. 기존에는 응답에 존재하지 않는 month, totalMeals 필드를 그대로 화면에 표시하여 undefined건으로 렌더링되었습니다.
  • GET /meals/ai-generations/{id} 상태 조회 API(getAiGenerationApi)를 추가하고, generate()가 2초 간격(최대 90초)으로 SUCCEEDED/FAILED까지 폴링하도록 변경하였습니다.
  • 두 엔드포인트 모두 생성 요약을 반환하지 않으므로, 성공 시 GET /diets에서 해당 월의 식단 개수를 집계하여 생성된 식단 수로 표시하도록 하였습니다.
  • 이미 생성된 월에 대한 409 응답 시, 기존 식단이 있으면 해당 요약을 표시하고 아직 생성 중이면 안내 문구를 표시하도록 하였습니다.
  • 생성 실패·타임아웃 시 서버 에러 메시지를 결과 패널의 에러 영역에 표시하도록 하였습니다. 기존에는 실패 시 아무 안내 없이 초기 화면으로 돌아갔습니다.
  • 폴링 중 다시 생성·reset 실행 시 이전 폴링 루프가 상태를 덮어쓰지 않도록 시퀀스 가드를 추가하였습니다.

🤝 리뷰 시 참고사항

  • EvaluationPanel이 사용하는 budgetInfo·validationErrors는 optional로 유지하여 기존 폴백(?? {}, ?? []) 동작이 그대로 유지됩니다.
  • 폴링 간격(2초)과 최대 대기 시간(90초)은 임의 값입니다. AI 생성 소요 시간에 맞춰 조정이 필요하면 의견 부탁드립니다.

@g-hyxn g-hyxn added the bug Something isn't working label Jul 4, 2026
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hororog Ready Ready Preview, Comment Jul 4, 2026 3:29pm

@g-hyxn g-hyxn self-assigned this Jul 4, 2026
@g-hyxn
g-hyxn merged commit f95af69 into develop Jul 4, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1dffc94e Deployed Jul 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant