fix(memory): sync new memories into pgvector
Memind CI / Test, build, and release guards (push) Successful in 2m31s
Memind CI / Test, build, and release guards (push) Successful in 2m31s
This commit is contained in:
@@ -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 } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user