group select chats

This commit is contained in:
2026-03-04 15:51:55 +00:00
parent 3249378984
commit 98a6a69477
4 changed files with 311 additions and 39 deletions
+6 -1
View File
@@ -262,13 +262,17 @@ piRestRouter.delete('/pi/sessions', async (ctx: Context) => {
}
const body = await ctx.req.json().catch(() => ({}));
const sessionIds = Array.isArray(body.sessionIds) ? (body.sessionIds as string[]) : undefined;
const contextFilter = body.context
? { context: body.context as string, contextId: body.contextId as string | undefined }
: undefined;
const userHome = getHomeDir(user.email);
try {
const sessions = await storage.listUserSessions(userHome, contextFilter);
const allSessions = await storage.listUserSessions(userHome, contextFilter);
const sessions = sessionIds
? allSessions.filter((s) => sessionIds.includes(s.id))
: allSessions;
let deleted = 0;
for (const session of sessions) {
try {
@@ -283,6 +287,7 @@ piRestRouter.delete('/pi/sessions', async (ctx: Context) => {
deleted,
total: sessions.length,
context: contextFilter?.context,
sessionIds: sessionIds?.length,
});
return ctx.json({ success: true, deleted });
} catch (err) {