fix(models): 圖片入門階對齊 Nano Banana 2 Lite + 統一兩個登錄表#98
Merged
Conversation
入門(便宜)階由舊世代 gemini-2.5-flash-image 對齊為 gemini-3.1-flash-lite-image
(Nano Banana 2 Lite),與 Gemini 官方三階(Lite / 2 / Pro)一致。
- core/infocards/models.py(圖片模型單一目錄):
- 入門階 id → gemini-3.1-flash-lite-image,內部 key legacy→lite
- 三階 label 對齊官方命名 Nano Banana 2 Lite / Nano Banana 2 / Nano Banana Pro
- MODEL_PRICING 補 lite 定價(0.002 估算,待官方校正);保留舊 2.5-flash-image
定價(diagram_image_gen / song_images 仍直接用,避免計帳記 $0)
- core/models.py(角色登錄表):image.fast / image.pro 的 id 改為直接引用 infocards
目錄的中等/貴兩階(單一來源,不再各寫一份 literal),兩個登錄表不再可能漂移
- 測試:新增漂移守衛(image 角色 == 目錄兩階)+ 入門階對齊/定價保留斷言
注:gemini-3.1-flash-lite-image 請於 live API 實測確認可用(沿用「先實測再上」紀律)。
frontend 走後端 image_model_options() 取選項,不受內部 key 改名影響。
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_017YfSHitPvSuuzVdVkhspWR
dofliu
marked this pull request as ready for review
July 10, 2026 06:23
dofliu
pushed a commit
that referenced
this pull request
Jul 14, 2026
反映 2026-07 兩項工作(PR #97 全庫審查、PR #98 圖片入門階對齊),並把後續接續工作 記錄進既有規劃文件: - README.md(中英雙語):圖片模型改為三階層 Nano Banana 2 Lite / 2 / Pro (gemini-3.1-flash-lite-image / -flash-image / gemini-3-pro-image) - ROADMAP.md:更新 v4.5 圖片三階層(PR #98);新增「程式碼健檢與後續改善」段 (體質結論 + 兩條主軸,指向 CODE_REVIEW_2026-07.md 與 TODO) - TODO.md:新增「程式碼審查後續改善」勾選清單(Sprint 1~4+,Tier 0 產品正確性 → T1 穩定性 → T2 安全 → T3 架構),routine 可依序認領;圖片對齊標為已完成 - docs/CHANGELOG.md:新增 2026-07 條目(REVIEW #97 / IMG-LITE #98) - HANDOFF.md:更新圖片模型 id 清單為新入門階 + 單一目錄說明 所有變更皆標註 gemini-3.1-flash-lite-image 待 live 實測。 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_017YfSHitPvSuuzVdVkhspWR
8 tasks
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.
做什麼 / What
把圖片模型的入門(便宜)階由舊世代
gemini-2.5-flash-image對齊為gemini-3.1-flash-lite-image(Nano Banana 2 Lite),讓三階與 Gemini 官方一致(Lite / 2 / Pro),並消除兩個登錄表的重複與漂移。
gemini-3.1-flash-lite-image← 本次改gemini-3.1-flash-imagegemini-3-pro-image改動:
core/infocards/models.py(圖片模型單一目錄):入門階 id 更新;內部 keylegacy→lite;三階 label 對齊官方命名;MODEL_PRICING補 lite 定價(0.002估算),並保留gemini-2.5-flash-image定價。core/models.py(角色登錄表):image.fast/image.pro的 id 改為直接引用上面的目錄(單一來源),兩表不再各寫一份 literal → 不可能再漂移。為什麼 / Why
先前盤點(見
docs/CODE_REVIEW_2026-07.mdT0-4 / T3-2)發現 image model id 多處分歧:core/infocards/models.py(3 階)與core/models.py(2 階)各寫一份、入門階還停在上一代2.5。本 PR 對齊入門階並讓兩表共用單一來源。
怎麼測 / How tested
pytest tests/test_models_registry.py tests/test_infocards_data.py→ 37 passedpytest tests/test_usage.py tests/test_check_models.py tests/test_settings.py tests/test_providers.py→ 70 passed, 4 skipped(skip 為 fastapi TestClient,環境未裝,CI 會跑)core.modelsimage 角色正確衍生自目錄、ROLES未變image_model_options(),內部 key 改名不影響)自我檢查 / Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_017YfSHitPvSuuzVdVkhspWR
Generated by Claude Code