Skip to content

feat(vibe coding PR): 支持建卡完成后的可选生图 - #202

Open
LMH168 wants to merge 5 commits into
1024XEngineer:mainfrom
LMH168:character-portrait-generation
Open

feat(vibe coding PR): 支持建卡完成后的可选生图#202
LMH168 wants to merge 5 commits into
1024XEngineer:mainfrom
LMH168:character-portrait-generation

Conversation

@LMH168

@LMH168 LMH168 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

关联 Issue

Closes #199

主要改动

  • 后端新增人物肖像生成工作流:人物卡快照、中文提示词整理、通义万相图片生成、并发保护和业务错误码。
  • SDK 新增 generatePortrait(...) 及对应请求/响应类型。
  • 人物卡准备页新增“生成图片”入口和弹窗,玩家可自行选择是否生图,不影响注册、房间或开局流程。
  • 默认仍保持关闭,CI 和本地未配置密钥时走离线/确定性分支,不产生外部调用。
  • 补充 .env.example 和 README 配置说明。

采用该方案的原因

  • 把建卡和生图解耦,避免把无关流程绑进主链路。
  • 把入口放在等待页,更贴合“可选生图”的交互预期。
  • 默认关闭可避免误触外部费用,也方便 CI 稳定运行。

测试与验证

  • 后端人物生图相关测试:17 passed
  • DeepSeek/OpenAI adapter + 人物生图测试:30 passed
  • 后端全量测试:233 passed, 2 skipped
  • SDK:16 passed
  • ruff check / ty check / git diff --check / SDK lint-typecheck-build:通过
  • 前端 test/lint/build:通过

风险与回滚

  • 真实生图依赖 DEEPSEEK_API_KEYDASHSCOPE_API_KEY
  • 回滚只需关闭 CHARACTER_PORTRAIT_ENABLED,默认行为不变。
  • 当前版本不保存图片历史,不影响现有建卡、注册、房间和开局流程。

UI 证据

  • 等待页已加入生图按钮和弹窗,本地 demo 可直接预览。

AI 使用情况

  • 使用现有 DeepSeek 结构化输出客户端生成中文提示词,并保留确定性 fallback。
  • 关键提示词、摘要和回退文案统一为中文,便于 review。

自检

  • 改动范围符合 Issue
  • 不包含无关改动
  • 已包含必要测试和文档
  • 不包含密钥、个人信息或非预期生成物
  • 已完成 AI 辅助质量检查和人工 Review

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review Summary

Found one merge-blocking validation issue. The full backend test suite passes locally (233 passed, 2 skipped), as do Ruff lint and ty, but the required Ruff formatting check fails on the current head. No additional high-confidence quality, performance, security, or documentation findings were identified.

and self.portrait_image_provider == "dashscope"
and (self.dashscope_api_key is None or not secret_value(self.dashscope_api_key).strip())
):
raise ValueError("角色生图使用 DashScope 时必须设置 DASHSCOPE_API_KEY")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Restore the required backend formatting check

uv run ruff format --check . fails on this head and reports that app/adapters/deepseek_models.py, app/core/config.py, app/service/portrait_generation.py, and tests/test_portrait_generation.py would be reformatted. This is also why the backend test check is red. Please run Ruff formatting and commit the resulting changes so the required CI job can pass.

@LMH168 LMH168 changed the title feat(character-portrait): 支持建卡完成后的可选生图 feat(vibe coding PR): 支持建卡完成后的可选生图 Jul 31, 2026
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.

[Feature][Character] 支持建卡完成后生成角色图片的 AIGC 工作流

1 participant