mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Normalize mistaken user owners across extraction and cognition
This commit is contained in:
@@ -14,6 +14,14 @@ import {
|
||||
setManualActiveRegion,
|
||||
} from "../graph/knowledge-state.js";
|
||||
|
||||
globalThis.SillyTavern = {
|
||||
getContext() {
|
||||
return {
|
||||
name1: "露西亚",
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const graph = createEmptyGraph();
|
||||
const erinA = createNode({
|
||||
type: "character",
|
||||
@@ -168,4 +176,24 @@ assert.deepEqual(
|
||||
["character", "user"],
|
||||
);
|
||||
|
||||
const aliasMatchedUserOwner = resolveKnowledgeOwner(graph, {
|
||||
ownerType: "character",
|
||||
ownerName: "露 西 亚",
|
||||
});
|
||||
assert.equal(aliasMatchedUserOwner.ownerType, "user");
|
||||
assert.equal(aliasMatchedUserOwner.ownerName, "露西亚");
|
||||
|
||||
const syntheticGraph = createEmptyGraph();
|
||||
syntheticGraph.historyState.activeUserPovOwner = "玩家";
|
||||
addNode(
|
||||
syntheticGraph,
|
||||
createNode({
|
||||
type: "character",
|
||||
fields: { name: "玩 家" },
|
||||
seq: 1,
|
||||
}),
|
||||
);
|
||||
const syntheticOwners = listKnowledgeOwners(syntheticGraph);
|
||||
assert.equal(syntheticOwners.some((entry) => entry.ownerType === "character"), false);
|
||||
|
||||
console.log("knowledge-state tests passed");
|
||||
|
||||
Reference in New Issue
Block a user