MCPcopy
hub / github.com/ModelEngine-Group/nexent / loadMemoryConfig

Function loadMemoryConfig

frontend/services/memoryService.ts:67–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67export async function loadMemoryConfig(): Promise<MemoryConfig> {
68 try {
69 const res = await requestJson(API_ENDPOINTS.memory.config.load, {
70 method: "GET",
71 headers: getAuthHeaders(),
72 });
73
74 // Backend returns plain config object directly
75 const cfg = res || {};
76
77 const memorySwitchVal: string =
78 cfg.MEMORY_SWITCH ?? cfg.memory_switch ?? "Y";
79 const shareVal: string =
80 cfg.MEMORY_AGENT_SHARE ?? cfg.memory_agent_share ?? "always";
81 const disableAgentIds: string[] =
82 cfg.DISABLE_AGENT_ID ?? cfg.disable_agent_id ?? [];
83 const disableUserAgentIds: string[] =
84 cfg.DISABLE_USERAGENT_ID ?? cfg.disable_useragent_id ?? [];
85
86 return {
87 memoryEnabled: memorySwitchVal === "Y",
88 shareOption: (shareVal || "always") as "always" | "ask" | "never",
89 disableAgentIds,
90 disableUserAgentIds,
91 };
92 } catch (e) {
93 log.error("loadMemoryConfig error", e);
94 // fall back to defaults
95 return {
96 memoryEnabled: true,
97 shareOption: "always",
98 disableAgentIds: [],
99 disableUserAgentIds: [],
100 };
101 }
102}
103
104export async function setMemorySwitch(enabled: boolean): Promise<boolean> {
105 try {

Callers 2

ChatHeaderFunction · 0.90
useMemoryFunction · 0.90

Calls 3

getAuthHeadersFunction · 0.90
errorMethod · 0.80
requestJsonFunction · 0.70

Tested by

no test coverage detected