Repository navigation
fix(worldbook): enforce group card binding and remove UI redundant reloads - #204
Merged
Merged
Conversation
…ilter Entries belonging to groups with character_card_ids bindings are now scoped to only those character cards during system prompt and finalize hooks. Entries without any binding remain global as before; the entry-level character_card_id still takes priority over group-level scoping. Also removes redundant post-mutation list reloads from the UI by using the values returned by create/update/delete/toggle/copyToGroup operations to update local state directly. Adds 4 group isolation regression tests covering the corrected behaviour.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明 / Description
背景与动机 / Context and motivation
两个 bug:
改动范围 / Changes
src/main.ts/dist/main.js:readEnabledEntries新增并行读取 groups.json,构建条目→组绑定卡列表的索引;matchesCharacterCardWithGroups在条目没有直接绑定时检查所属组的 character_card_ids;空绑定组仍为全局;条目级绑定优先。两个 hook 均改用新函数。src/ui/worldbook_manager/index.ui.ts/dist/ui/worldbook_manager/index.ui.js:doToggle、doDelete、doSave(创建 & 编辑)、doImport、doSaveGroup、doDeleteGroup、doCopyToGroup 改为直接用 RPC 返回值更新本地 state,不再触发完整列表重新加载;仅显式刷新和首次加载走全量读取。tests/worldbook_group_isolation.test.cjs:覆盖组绑定生效、组绑定隔离(card_A 条目不出现在 card_B)、空绑定保持全局、条目级绑定优先共 4 个回归用例。兼容性与风险 / Compatibility and risks
存储格式不变;只改注入过滤逻辑,原有条目级 character_card_id 行为不受影响。UI 本地状态逻辑依赖 RPC 返回值与存储一致,失败路径不变。
关联 Issue / Related issue
N/A。来源于 fix/worldbook-ui-latency 修复分支。
验证方式 / Verification
检查清单 / Checklist