fix(core): guard world_lores as array when loading preset - #1028
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Walkthrough
Changes预设提示词解析
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change prevents preset loading from failing when world_lores is not an array and otherwise preserves the existing parsing behavior; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
问题
在加载 preset 时,如果 YAML 中的
world_lores字段不是数组(例如为null或空对象),调用rawJson.world_lores.find(...)会抛错,导致 preset 加载失败。修复
在调用
find前先检查Array.isArray(rawJson.world_lores),非数组时跳过 world lore 解析。变更
packages/core/src/llm-core/prompt/preset_prompt_parse.ts: 增加数组类型守卫