Implement scoped memory graph and refresh defaults

This commit is contained in:
Youzini-afk
2026-04-03 20:48:07 +08:00
parent fbd8b00f1f
commit c60f60f349
21 changed files with 1706 additions and 352 deletions

View File

@@ -3,6 +3,7 @@
import { getRequestHeaders } from "../../../../script.js";
import { embedBatch, embedText, searchSimilar } from "./embedding.js";
import { getActiveNodes } from "./graph.js";
import { describeMemoryScope, normalizeMemoryScope } from "./memory-scope.js";
import { resolveConfiguredTimeoutMs } from "./request-timeout.js";
import { buildVectorCollectionId, stableHashString } from "./runtime-state.js";
@@ -288,6 +289,18 @@ export function buildNodeVectorText(node) {
parts.push(`${key}: ${value}`);
}
const scope = normalizeMemoryScope(node?.scope);
const scopeText = describeMemoryScope(scope);
if (scopeText) {
parts.push(`memory_scope: ${scopeText}`);
}
if (scope.regionPath.length > 0) {
parts.push(`memory_region_path: ${scope.regionPath.join(" / ")}`);
}
if (scope.regionSecondary.length > 0) {
parts.push(`memory_region_secondary: ${scope.regionSecondary.join(", ")}`);
}
return parts.join(" | ").trim();
}