semantic search within project

This commit is contained in:
Storme-bit
2026-04-15 03:15:26 -07:00
parent e1c16a5714
commit 27e3c98304
2 changed files with 29 additions and 15 deletions

View File

@@ -65,13 +65,20 @@ function deleteSession(id) {
function updateSession(id, { name, projectId } = {}) {
const db = getDB();
db.prepare(`
UPDATE sessions
SET name = ?,
project_id = COALESCE(?, project_id),
updated_at = unixepoch()
WHERE id = ?
`).run(name ?? null, projectId ?? null, id);
// Build update dynamically based on what was provided
const updates = [];
const values = [];
if (name !== undefined) { updates.push('name = ?'); values.push(name ?? null); }
if (projectId !== undefined) { updates.push('project_id = ?'); values.push(projectId ?? null); }
if (updates.length === 0) return getSession(id);
updates.push('updated_at = unixepoch()');
values.push(id);
db.prepare(`UPDATE sessions SET ${updates.join(', ')} WHERE id = ?`).run(...values);
return getSession(id);
}