Fix cognition owner label collisions in UI

This commit is contained in:
Youzini-afk
2026-04-09 23:11:51 +08:00
parent 0b116820b3
commit 3e90c64310
3 changed files with 234 additions and 20 deletions

View File

@@ -114,6 +114,18 @@ applyCognitionUpdates(
],
{ changedNodeIds: [bellEvent.id] },
);
applyCognitionUpdates(
graph,
[
{
ownerType: "user",
ownerName: "露西亚",
knownRefs: [bellEvent.id],
visibility: [{ ref: bellEvent.id, score: 0.8 }],
},
],
{ changedNodeIds: [bellEvent.id] },
);
applyManualKnowledgeOverride(graph, {
ownerKey: ownerA.ownerKey,
nodeId: bellEvent.id,
@@ -149,5 +161,11 @@ assert.ok(
(entry) => entry.ownerName === "露西亚" && entry.knownCount >= 1,
),
);
const sameNameOwners = ownerList.filter((entry) => entry.ownerName === "露西亚");
assert.equal(sameNameOwners.length, 2);
assert.deepEqual(
sameNameOwners.map((entry) => entry.ownerType).sort(),
["character", "user"],
);
console.log("knowledge-state tests passed");