修复 AGC 栏目画布上传素材落「待归类」(#359) #596

Merged
suzmii merged 2 commits from fix/agc-asset-upload-category into master 2026-10-03 17:58:03 +08:00
Member

问题(Issue #359)

AGC 客户端在资源栏目子画布(「UI 交互 / 角色与对象 / 场景与环境 / 音频」)左下角工具栏点「上传」后,提示条给出「已上传 1 个素材」,但当前栏目计数不变(仍「0 项」)、素材出现在「待归类」。用户看到的是"上传成功了,但它从这一页消失了"。

根因:上传登记的 manifest kind 只由内容证据推导(assets.rs::uploaded_asset_kind),图片 / 视频 / 代码都派生成 unclassified;kind 派生分类与栏目词汇(ui-interaction / character / scene / audio)不是同一套,而 upload_local_asset 原先不接受入口栏目。生成入口早就有 targetCategory(GUI 完成登记以入口栏目为准),上传漏了这半边。

改动

位置 前 后
Rust upload_local_asset { projectPath, fileName, mediaType, bytes } 增加可选 targetCategory;登记走 register_local_asset_entry_with_category(非法值失败关闭、不回退 kind 派生)
Rust upload_local_asset_at 唯一入口 委托新的 upload_local_asset_at_with_category(既有约 25 处调用点与单测不动,不传时行为不变)
前端 uploadProjectAssetFilesAndReadSnapshot 不透传栏目 透传可选 targetCategory
栏目画布底部工具栏上传 不带栏目 带上工具栏自己的栏目(resourceCanvasBottomToolbarCategory),与生成入口同一口径

效果:在「角色与对象」里上传 hero.png,素材直接登记进「角色与对象」(category: character),当场出现在上传它的那一页;不再落「待归类」。

边界

  • 不传 targetCategory 时保持既有 kind 派生:资源面板(跨栏目列表、不是栏目工具)、UI 编辑器图片导入、聊天附件上传都不变。
  • 前端不做伪分类:取值合法性、失败关闭都在原生。
  • 未动 external v1 / OpenAPI、SpacetimeDB schema、packages/。

验证

  • cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --features=cocos-editor-execute,unity-editor-execute,godot-editor-execute --bin genarrative-ai-game-creator-shell assets::tests → 27 passed(新增 upload_registers_into_the_explicit_entry_category:显式栏目 → character、不传 → unclassified、非法 version 失败关闭且不新增登记)
  • npx vitest run apps/ai-game-creator-shell/tests/appSurface.test.ts → 196 passed / 9 skipped(新增「uploads toolbar files into the entry column so they stay visible where they were uploaded」:在空白的「角色与对象」栏目里上传图片,upload_local_asset 载荷必须带 targetCategory: 'character')
  • npm run agc:typecheck(exit 0)、npm run check:encoding、git diff --check、cargo fmt --check(AGC crate)

文档

PRD §3.10、docs/technical/【AGC】栏目画布底部工具栏入口矩阵-2026-09-13.md §4 载荷表、V3 验收用例 S11a、decision-log.md、pitfalls.md。

Closes #359

## 问题(Issue #359) AGC 客户端在资源栏目子画布(「UI 交互 / 角色与对象 / 场景与环境 / 音频」)左下角工具栏点「上传」后,提示条给出「已上传 1 个素材」,但当前栏目计数不变(仍「0 项」)、素材出现在「待归类」。用户看到的是"上传成功了,但它从这一页消失了"。 根因:上传登记的 manifest `kind` 只由**内容证据**推导(`assets.rs::uploaded_asset_kind`),图片 / 视频 / 代码都派生成 `unclassified`;kind 派生分类与栏目词汇(`ui-interaction` / `character` / `scene` / `audio`)不是同一套,而 `upload_local_asset` 原先不接受入口栏目。生成入口早就有 `targetCategory`(GUI 完成登记以入口栏目为准),上传漏了这半边。 ## 改动 | 位置 | 前 | 后 | | --- | --- | --- | | Rust `upload_local_asset` | `{ projectPath, fileName, mediaType, bytes }` | 增加可选 `targetCategory`;登记走 `register_local_asset_entry_with_category`(非法值失败关闭、不回退 kind 派生) | | Rust `upload_local_asset_at` | 唯一入口 | 委托新的 `upload_local_asset_at_with_category`(既有约 25 处调用点与单测不动,不传时行为不变) | | 前端 `uploadProjectAssetFilesAndReadSnapshot` | 不透传栏目 | 透传可选 `targetCategory` | | 栏目画布底部工具栏上传 | 不带栏目 | 带上工具栏自己的栏目(`resourceCanvasBottomToolbarCategory`),与生成入口同一口径 | 效果:在「角色与对象」里上传 `hero.png`,素材直接登记进「角色与对象」(`category: character`),当场出现在上传它的那一页;不再落「待归类」。 ## 边界 - 不传 `targetCategory` 时保持既有 kind 派生:资源面板(跨栏目列表、不是栏目工具)、UI 编辑器图片导入、聊天附件上传都不变。 - 前端不做伪分类:取值合法性、失败关闭都在原生。 - 未动 external v1 / OpenAPI、SpacetimeDB schema、`packages/`。 ## 验证 - `cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --features=cocos-editor-execute,unity-editor-execute,godot-editor-execute --bin genarrative-ai-game-creator-shell assets::tests` → 27 passed(新增 `upload_registers_into_the_explicit_entry_category`:显式栏目 → `character`、不传 → `unclassified`、非法 `version` 失败关闭且不新增登记) - `npx vitest run apps/ai-game-creator-shell/tests/appSurface.test.ts` → 196 passed / 9 skipped(新增「uploads toolbar files into the entry column so they stay visible where they were uploaded」:在空白的「角色与对象」栏目里上传图片,`upload_local_asset` 载荷必须带 `targetCategory: 'character'`) - `npm run agc:typecheck`(exit 0)、`npm run check:encoding`、`git diff --check`、`cargo fmt --check`(AGC crate) ## 文档 PRD §3.10、`docs/technical/【AGC】栏目画布底部工具栏入口矩阵-2026-09-13.md` §4 载荷表、V3 验收用例 S11a、`decision-log.md`、`pitfalls.md`。 Closes #359
suzmii added 1 commit 2026-10-03 17:20:08 +08:00
修复 AGC 栏目画布上传素材落「待归类」(Issue 359)
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m17s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 3m59s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m8s
Project CI / Backend tests (pull_request) Successful in 6m24s
Project CI / Frontend tests (pull_request) Successful in 3m24s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m34s
Project CI / Native shell tests (pull_request) Successful in 6m49s
Project CI / Repository checks (pull_request) Successful in 5m38s
372b7d3a00
- AGC Rust `upload_local_asset` 新增可选 `targetCategory`,登记改走 `register_local_asset_entry_with_category`(非法值失败关闭,不回退 kind 派生);`upload_local_asset_at` 委托新的 `upload_local_asset_at_with_category`,既有调用点与单测不动
- 前端 `uploadProjectAssetFilesAndReadSnapshot` 透传 `targetCategory`;栏目画布底部工具栏上传带上工具栏自己的栏目,与生成入口的 `targetCategory` 同一口径
- 新增 Rust 单测 `upload_registers_into_the_explicit_entry_category`(显式栏目 → character / 不传 → unclassified / 非法 version 失败关闭且不新增登记)与 appSurface 用例(在「角色与对象」上传图片,载荷必须带 `targetCategory: 'character'`)
- 同步 PRD §3.10、`docs/technical/【AGC】栏目画布底部工具栏入口矩阵-2026-09-13.md` §4 载荷表、V3 验收用例 S11a、decision-log 与 pitfalls
suzmii added 1 commit 2026-10-03 17:55:48 +08:00
review 反馈:补齐 targetCategory 的文档与注释口径(#359)
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m27s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m37s
Project CI / Backend tests (pull_request) Failing after 31s
Project CI / Repository checks (pull_request) Failing after 28s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m54s
Project CI / Frontend tests (pull_request) Successful in 3m18s
Project CI / AI game creator shell web tests (pull_request) Successful in 3m28s
Project CI / Native shell tests (pull_request) Successful in 7m28s
86e74867ae
- 实施计划合同补上「GUI 上传与图片类生成同一 targetCategory 口径,不传时仍按内容证据派生 kind」
- 栏目画布底部工具栏入口矩阵 §1 一句话补上「带当前栏目 targetCategory」
- 工具栏模型里上传入口的类型注释写明入口栏目与「待归类」的因果
- 修正占位落点 effect 里陈旧的示例:普通图片只在 Agent / Direct 不传 targetCategory 时才落「待归类」
suzmii merged commit 0b03d563c2 into master 2026-10-03 17:58:03 +08:00
suzmii deleted branch fix/agc-asset-upload-category 2026-10-03 17:58:03 +08:00
Sign in to join this conversation.