fix(memory): sync new memories into pgvector
Memind CI / Test, build, and release guards (push) Successful in 2m31s

This commit is contained in:
john
2026-07-21 23:27:15 +08:00
parent 6f4a3b53d0
commit c2e2209344
8 changed files with 425 additions and 57 deletions
+6 -2
View File
@@ -126,6 +126,7 @@ export function createMemoryV2LifecycleService({ pool = null, env = process.env,
params,
);
let promoted = 0;
const promotedUserIds = new Set();
for (const row of rows) {
const id = crypto.createHash('sha256').update(`${row.user_id}\n${row.memory_type}\n${row.content}`).digest('hex');
const hash = crypto.createHash('sha256').update(`${row.user_id}\n${row.content}`).digest('hex');
@@ -135,10 +136,13 @@ export function createMemoryV2LifecycleService({ pool = null, env = process.env,
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)`,
[id, row.user_id, row.memory_type === 'semantic' ? 'knowledge' : row.memory_type, hash, row.content, null, row.session_id, row.confidence, 'active', row.evidence_json, row.created_at, now()],
);
if (Number(result?.affectedRows ?? 0) > 0) promoted += 1;
if (Number(result?.affectedRows ?? 0) > 0) {
promoted += 1;
promotedUserIds.add(String(row.user_id));
}
}
metrics.promote += 1;
return { ok: true, skipped: false, promoted };
return { ok: true, skipped: false, promoted, promotedUserIds: [...promotedUserIds] };
}
async function reflect({ userId = null } = {}) {