semantic search within project
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user