修复 AGC 栏目画布上传素材落「待归类」(#359) #596
Reference in New Issue
Block a user
Delete Branch "fix/agc-asset-upload-category"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题(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 完成登记以入口栏目为准),上传漏了这半边。改动
upload_local_asset{ projectPath, fileName, mediaType, bytes }targetCategory;登记走register_local_asset_entry_with_category(非法值失败关闭、不回退 kind 派生)upload_local_asset_atupload_local_asset_at_with_category(既有约 25 处调用点与单测不动,不传时行为不变)uploadProjectAssetFilesAndReadSnapshottargetCategoryresourceCanvasBottomToolbarCategory),与生成入口同一口径效果:在「角色与对象」里上传
hero.png,素材直接登记进「角色与对象」(category: character),当场出现在上传它的那一页;不再落「待归类」。边界
targetCategory时保持既有 kind 派生:资源面板(跨栏目列表、不是栏目工具)、UI 编辑器图片导入、聊天附件上传都不变。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