blank session cleanup improvements

- make the blank session cleanup system optionally fetch full message histories for each session to better judge if it's blank
- make a command that does the deep clean, keep the clean that happens on new session creation shallow
This commit is contained in:
Alexis Dumas
2025-11-24 11:46:02 -05:00
committed by Alexis Purslane
parent f633d75005
commit 50676416ed
4 changed files with 68 additions and 25 deletions

View File

@@ -16,6 +16,7 @@ import { showAlertDialog } from "../../stores/alerts"
import type { Instance } from "../../types/instance"
import type { MessageRecord } from "../../stores/message-v2/types"
import { messageStoreBus } from "../../stores/message-v2/bus"
import { cleanupBlankSessions } from "../../stores/session-state"
export interface UseCommandsOptions {
preferences: Accessor<Preferences>
@@ -142,6 +143,19 @@ export function useCommands(options: UseCommandsOptions) {
},
})
commandRegistry.register({
id: "cleanup-blank-sessions",
label: "Cleanup Blank Sessions",
description: "Remove empty sessions from the current instance",
category: "Session",
keywords: ["cleanup", "blank", "empty", "sessions", "remove", "delete"],
action: async () => {
const instance = activeInstance()
if (!instance) return
await cleanupBlankSessions(instance.id, undefined, true)
},
})
commandRegistry.register({
id: "switch-to-info",
label: "Instance Info",