MCPcopy Create free account
hub / github.com/MemTensor/MemOS / embedMemoryAsync

Method embedMemoryAsync

packages/memos-core/src/hub/server.ts:258–271  ·  view source on GitHub ↗
(memoryId: string, summary: string, content: string)

Source from the content-addressed store, hash-verified

256 }
257
258 private embedMemoryAsync(memoryId: string, summary: string, content: string): void {
259 const embedder = this.opts.embedder;
260 if (!embedder) return;
261 const text = (summary || content || "").slice(0, 500);
262 if (!text) return;
263 embedder.embed([text]).then((vectors) => {
264 if (vectors[0]) {
265 this.opts.store.upsertHubMemoryEmbedding(memoryId, new Float32Array(vectors[0]));
266 this.opts.log.info(`hub: embedded shared memory ${memoryId}`);
267 }
268 }).catch((err) => {
269 this.opts.log.warn(`hub: embedding shared memory failed: ${err}`);
270 });
271 }
272
273 private async handle(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
274 const url = new URL(req.url || "/", `http://127.0.0.1:${this.port}`);

Callers 1

handleMethod · 0.95

Calls 4

embedMethod · 0.65
infoMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected