U-2①: 後端資訊圖卡逐區 refine 端點移植#81
Merged
Merged
Conversation
移植 /studio 缺的「圖卡逐區 refine」到後端(offline-first,全程 mock 測): - refine_service.refine_infographic_section:依指令重生單一 section,merge 原欄位、 iconType 越界退 info、imagePrompt 有變才重生該區圖(不燒額度),策略對齊既有 refine_presentation_slide。 - 新端點 POST /api/refine-section(掛 rate_limit)。 - 補 8 測(mock Gemini,涵蓋 merge/coerce/條件重生圖/端點)。 海報為單圖無區概念,整圖 refine 已由 /api/generate 的 refinement 涵蓋。 前端區域選擇 UI(U-2②)另開 PR。
dofliu
pushed a commit
that referenced
this pull request
Jun 15, 2026
#81 把 /api/refine-section 路由改採「收/回單一 section」契約並加 tests/test_infocards_refine.py 覆蓋,但遺留 test_infocards_infographic.py ::TestRefineSection 的兩個路由測試仍送舊形狀 {infographic, sectionId} → 回 422, 使 main CI 紅。移除這兩個過時路由測試(端到端覆蓋已在 test_infocards_refine.py), 保留其餘 infographic_service 函式單元測試。 https://claude.ai/code/session_011KcsjSFoGvB92odmj4VtKK
dofliu
added a commit
that referenced
this pull request
Jun 15, 2026
* U-2②: 前端資訊圖卡逐區 refine 接上 #81 後端契約 /app 視覺站的逐區微調原送舊形狀 {infographic, sectionId} 並讀 data.data, 與 #81 實際落地的 POST /api/refine-section(收/回單一 section)對不上,逐區 微調實際打不通。改成與 sibling 單頁微調 /api/refine 同形狀:送 section、 讀 data.section、patch 回 result.data.sections[idx]。純前端一檔,vite build 通過。 docs/PRODUCT_READINESS.md U-2 標 [x](①②③到齊)。 https://claude.ai/code/session_011KcsjSFoGvB92odmj4VtKK * test: 移除 refine-section 舊契約路由測試(對齊 #81 單一 section 路由) #81 把 /api/refine-section 路由改採「收/回單一 section」契約並加 tests/test_infocards_refine.py 覆蓋,但遺留 test_infocards_infographic.py ::TestRefineSection 的兩個路由測試仍送舊形狀 {infographic, sectionId} → 回 422, 使 main CI 紅。移除這兩個過時路由測試(端到端覆蓋已在 test_infocards_refine.py), 保留其餘 infographic_service 函式單元測試。 https://claude.ai/code/session_011KcsjSFoGvB92odmj4VtKK --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
做什麼
移植
/studio缺的「資訊圖卡逐區 refine」到後端,補上 U-2 盤點出的唯一「大」缺口(後端 refine 圖卡未移植)。core/infocards/refine_service.pyrefine_infographic_section(section, instruction, *, model, image_model, regenerate_image):依指令重生單一InfographicSection。策略對齊既有refine_presentation_slide:info(對齊infographic_service._coerce)。build_refine_section_prompt(無 responseSchema,對齊原版)。server/routes/infocards.pyPOST /api/refine-section(掛rate_limit,與/api/refine、/api/generate一致)+RefineSectionRequestschema。海報為單張圖、無「區」概念,整圖 refine 已由
/api/generate的refinement參數涵蓋,故本項聚焦資訊圖卡 section 逐區 refine。為什麼
怎麼測
tests/test_infocards_refine.py:TestRefineSection+TestRefineSectionRoute):prompt 組裝 / merge 保留原欄位 / iconType coerce / imagePrompt 變更才重生圖 / 不變不生圖 / 關閉重生 / 端點整合,全程 mock Gemini。tests/test_infocards_refine.py18 passed;infocards 子集 52 passed;全套 2433 passed,3 個失敗為容器缺 Noto CJK 字型的像素斷言假象(QR white_blocks + pptx journal theme signature),與本改動無關,CI 有裝字型。Reviewer 決策點
/api/refine-section(與既有/api/refine並列)vs 合併進/api/refine加 mode 判別 — 採前者(shape 不同、語意清楚)。如偏好合併可提。regenerateImage=True),可由前端傳regenerateImage=False純改文字不動圖。Generated by Claude Code