chat: delete sessions + auto-refresh the /chat list after each turn
DELETE /chat/sessions/:id removes Claude's transcript file; the list gets a per-row delete button. The list also invalidates on turn-complete so new and continued sessions surface without a manual refresh. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createRouter } from '../../create-router';
|
||||
import { getClaudeSessionsCwd, listClaudeSessions, loadClaudeSession } from './claude-sessions';
|
||||
import { getClaudeSessionsCwd, listClaudeSessions, loadClaudeSession, deleteClaudeSession } from './claude-sessions';
|
||||
|
||||
export const chatRouter = createRouter();
|
||||
|
||||
@@ -18,3 +18,11 @@ chatRouter.get('/sessions/:id', (ctx) => {
|
||||
if (!detail) return ctx.text('Not found', 404);
|
||||
return ctx.json(detail);
|
||||
});
|
||||
|
||||
// DELETE /chat/sessions/:id — remove a conversation (deletes Claude's transcript file).
|
||||
chatRouter.delete('/sessions/:id', (ctx) => {
|
||||
const email = ctx.get('user').email;
|
||||
const ok = deleteClaudeSession(email, getClaudeSessionsCwd(email), ctx.req.param('id'));
|
||||
if (!ok) return ctx.text('Not found', 404);
|
||||
return ctx.json({ ok: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user