fix: tolerate null legacy custom-world profile

This commit is contained in:
kdletters
2026-05-21 17:49:07 +08:00
parent 41075e41a2
commit 224a26d318
3 changed files with 60 additions and 1 deletions

View File

@@ -398,6 +398,14 @@
- 验证:`npm run test -- src/data/customWorldLibrary.test.ts src/components/CustomWorldResultView.test.tsx`,确认生成后即使父层做一次归一化回写,开局 CG 仍继续显示。
- 关联:`src/data/customWorldLibrary.ts``src/components/rpg-creation-result/RpgCreationResultViewImpl.tsx``src/components/CustomWorldEntityCatalog.tsx`
## RPG 发布报 legacy_result_profile_json 非法先查 null 兼容
- 现象RPG 结果页发布动作返回 `UPSTREAM_ERROR`SpacetimeDB details 里是 `custom_world.compile.legacy_result_profile_json 不是合法 JSON object`
- 原因:`publish_world` 前端契约只要求 `{ action: 'publish_world' }``ExecuteCustomWorldAgentActionRequest.legacy_result_profile` 是可选字段,经 HTTP / serde / SpacetimeDB payload 传递时可能显式成为 JSON `null`。旧的编译器只接受 object 或缺省,把 `Some("null")` 当成非法 legacy JSON。
- 处理:`module-custom-world` 的 optional JSON object 解析要把 `null` 视为未提供,仍拒绝数组、字符串、数字和坏 JSON正式发布继续以 session `draft_profile_json` 为草稿真相。
- 验证:`cargo test -p module-custom-world published_profile_compile --manifest-path server-rs/Cargo.toml`
- 关联:`server-rs/crates/module-custom-world/src/application.rs``server-rs/crates/spacetime-module/src/custom_world.rs``docs/【玩法创作】平台入口与玩法链路-2026-05-15.md`
## 本地脚本调 VectorEngine 生图卡住先区分 fetch 首部超时
- 现象:用 Node `fetch` 直接请求 `POST /v1/images/generations`,已经设置较长的 AbortController 超时,但仍在约 180 到 300 秒后抛 `AbortError``TypeError: fetch failed``UND_ERR_HEADERS_TIMEOUT`;同一 prompt 改用原生 `https.request` 可以在较短时间内成功返回图片。