AGC 项目管理子画布上传素材会归类为 "未归类" 导致在上传它的页面看不到, 会有惊奇 #359

Closed
opened 2026-09-14 21:54:40 +08:00 by k88936 · 2 comments
Member

shotmd-1789393900.jpg

![shotmd-1789393900.jpg](/attachments/ea8a783f-1299-4146-a12c-3a09ee711245)
suzmii self-assigned this 2026-10-01 13:34:23 +08:00
Member

I'll fix

I'll fix
Member

修复已发 PR:#596

根因

栏目画布底部工具栏的「上传」调 upload_local_asset,而该命令里 manifest 的 kind 只由内容证据推导(assets.rs::uploaded_asset_kind):

  • 图片 / 视频 / 代码 → unclassified
  • 音频 → audio,文档 / 字体 → document

kind 派生分类与栏目词汇(ui-interaction / character / scene / audio)不是同一套,所以图片上传只能落「待归类」。生成入口早就有这条口径(start_local_project_asset_generation 的 targetCategory:GUI 完成登记以入口栏目为准),上传漏了这半边 —— 于是「已上传 1 个素材」弹出、当前栏目仍是「0 项」。

修法

upload_local_asset 增加可选 targetCategory,登记改走既有的 register_local_asset_entry_with_category(非法值失败关闭、不回退 kind 派生);前端 uploadProjectAssetFilesAndReadSnapshot 透传,栏目画布工具栏上传带上工具栏自己的栏目。效果:在「角色与对象」上传 hero.png,素材直接登记进「角色与对象」,当场出现在上传它的那一页。

不传 targetCategory 时行为不变(资源面板上传、UI 编辑器图片导入、聊天附件上传都不受影响)。

验证

  • cargo test ... --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(新增用例断言工具栏上传载荷带 targetCategory: 'character')
  • npm run agc:typecheck、npm run check:encoding、git diff --check、cargo fmt --check 全绿

改动范围:apps/ai-game-creator-shell/src-tauri/src/{assets.rs,commands/desktop.rs}、src/view/project-development/{projectResourceLiveUpdateModel.ts,index.tsx}、appSurface 用例,以及 PRD §3.10 / 工具栏入口矩阵 §4 / V3 验收 S11a / decision-log / pitfalls。

修复已发 PR:#596 ## 根因 栏目画布底部工具栏的「上传」调 `upload_local_asset`,而该命令里 manifest 的 `kind` 只由**内容证据**推导(`assets.rs::uploaded_asset_kind`): - 图片 / 视频 / 代码 → `unclassified` - 音频 → `audio`,文档 / 字体 → `document` kind 派生分类与栏目词汇(`ui-interaction` / `character` / `scene` / `audio`)不是同一套,所以图片上传只能落「待归类」。生成入口早就有这条口径(`start_local_project_asset_generation` 的 `targetCategory`:GUI 完成登记以入口栏目为准),上传漏了这半边 —— 于是「已上传 1 个素材」弹出、当前栏目仍是「0 项」。 ## 修法 `upload_local_asset` 增加可选 `targetCategory`,登记改走既有的 `register_local_asset_entry_with_category`(非法值失败关闭、不回退 kind 派生);前端 `uploadProjectAssetFilesAndReadSnapshot` 透传,栏目画布工具栏上传带上工具栏自己的栏目。效果:在「角色与对象」上传 `hero.png`,素材直接登记进「角色与对象」,当场出现在上传它的那一页。 不传 `targetCategory` 时行为不变(资源面板上传、UI 编辑器图片导入、聊天附件上传都不受影响)。 ## 验证 - `cargo test ... --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(新增用例断言工具栏上传载荷带 `targetCategory: 'character'`) - `npm run agc:typecheck`、`npm run check:encoding`、`git diff --check`、`cargo fmt --check` 全绿 改动范围:`apps/ai-game-creator-shell/src-tauri/src/{assets.rs,commands/desktop.rs}`、`src/view/project-development/{projectResourceLiveUpdateModel.ts,index.tsx}`、appSurface 用例,以及 PRD §3.10 / 工具栏入口矩阵 §4 / V3 验收 S11a / decision-log / pitfalls。
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GenarrativeAI/Genarrative#359