feat(editorial): magazine hero — nano-banana 인프라 + collage 렌더#445
Closed
cocoyoon wants to merge 2 commits into
Closed
feat(editorial): magazine hero — nano-banana 인프라 + collage 렌더#445cocoyoon wants to merge 2 commits into
cocoyoon wants to merge 2 commits into
Conversation
매거진 hero 가 source post 이미지 그대로라 curation_card 와 시각적 중복 + 매거진
표지 quality 미달이었음. nano-banana (gemini-2.5-flash-image) 로 16:9 editorial
cover 를 동적 생성.
- nano_banana.py: text-only generate(prompt, aspect_ratio) 메서드 추가.
기존 reframe (image+prompt edit mode) 와 분리.
- editorial_article/nodes/generate_hero.py: 신규 노드.
layout.title + subtitle + intro 섹션 → cover prompt → nano-banana →
R2 업로드 (editorial-magazines/{article_id}/hero.png) → layout.hero_image_url
+ hero 섹션의 image_url 갱신.
- editorial_article/graph.py: compose_layout → generate_hero → publish.
generate_hero 는 graceful — 실패해도 publish 진행하고 fallback (compose 가
픽한 source post 이미지) 사용. error_log 에만 기록.
- services/editorial_article/editorial_article_service.py: ctx 에서 nano +
r2 받아서 graph config 에 주입.
- managers/queue/worker.py: ctx 에 nano_banana_client + r2_client 추가.
- config/_container.py: nano_banana_client 를 RawPostsContainer 에서
InfrastructureContainer 로 이동 (raw_posts + editorial_article 공용).
RawPostsContainer 는 infrastructure.nano_banana_client 참조하도록 업데이트.
추가 시간 ~5-10s/article. 추가 비용 ~$0.01-0.04/article. #429
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
단일 AI 생성 hero (nano-banana, #429 PR #445) 대신 source 이미지 collage 로 교체. 매거진 내부 curation_card 와 시각적 일관성, AI 비용/시간 0, source fidelity 보존. - pickCollageImages: curation_card 섹션의 image_url top 4. 없으면 hero_image_url 단일 fallback. - CollageHero: 이미지 개수별 grid 패턴 (1: 단일, 2: 2-up, 3: 1+2, 4: 2x2). - SectionView: type='hero' 본문 섹션은 헤더 collage 가 담당하므로 스킵. (HeroSection 함수 제거 — dead code.) 기존에 생성된 article 도 frontend HMR 만으로 collage 렌더 적용. nano-banana hero 인프라 (PR #445) 는 그대로 유지 — 다른 용도 (예: OG 이미지 별도 생성) 나 향후 hybrid 모드에서 재활용 가능.
Member
Author
|
superseded by #446 (Stage 3 thumbnail flow) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
매거진 hero 이미지 두 가지 개선:
Why
초기 hero 는 source post 이미지 그대로 픽 → curation_card 와 시각적 중복, 표지 quality 미달. 두 경로를 모두 구축:
Changes
ai-server (nano-banana 인프라)
nano_banana.py: text-onlygenerate(prompt, aspect_ratio)추가 (기존reframeedit-mode 와 분리).editorial_article/nodes/generate_hero.py: 신규 노드. layout.title + intro → editorial cover prompt → nano-banana → R2 업로드 (editorial-magazines/{article_id}/hero.png) → layout.hero_image_url 갱신.editorial_article/graph.py:compose_layout → generate_hero → publish. graceful — 실패해도 publish 진행.editorial_article_service.py: ctx 에서 nano + r2 받아 graph config 주입.worker.py: ctx 에nano_banana_client+r2_client추가._container.py:nano_banana_client를RawPostsContainer→InfrastructureContainer로 이동 (raw_posts + editorial_article 공용).web (collage 렌더 — 현재 default)
MagazineRenderer.tsx:pickCollageImages: curation_card image_url top 4. 없으면 hero_image_url fallback.CollageHero: 1개 → 단일, 2 → 2-up, 3 → 1+2, 4 → 2x2 grid.hero본문 섹션은 header collage 가 담당하므로 스킵 (중복 방지).Trade-off
이 PR 머지 후 default 는 collage. nano-banana 가 R2 에 hero.png 를 계속 만들지만 (인프라 보존) frontend 가 안 씀. 나중에:
Test plan
generate_hero: ok article=... url=...확인 (인프라 정상)editorial-magazines/{article_id}/hero.png업로드 확인Bump
`bump:patch` (ai-server)