fix: active chat detection

Nicolas Leão committed Mar 26, 2026 at 11:30 UTC bb89b7ae7f6f469d9b2f2a8f3205c8fb06b77a85
1 file changed +4 -10
plugins/_chat_compaction/extensions/webui/chat-input-bottom-actions-start/compact-button.html
+4 -10
@@ -6,18 +6,12 @@
6 <body>
7 <div x-data="{
8 get disabled() {
9 - const ctx = globalThis.getContext?.();
10 - const store = Alpine?.store?.('compactStore');
11 - const chatInput = Alpine?.store?.('chatInput');
12 - return !ctx || store?.compacting || chatInput?.running;
9 + return !$store.chats?.selected || $store.compactStore?.compacting || $store.chatInput?.running;
10 },
11 get disabledReason() {
15 - const ctx = globalThis.getContext?.();
16 - const store = Alpine?.store?.('compactStore');
17 - const chatInput = Alpine?.store?.('chatInput');
18 - if (!ctx) return 'No active chat selected';
19 - if (store?.compacting) return 'Compaction in progress';
20 - if (chatInput?.running) return 'Cannot compact while agent is running';
12 + if (!$store.chats?.selected) return 'No active chat selected';
13 + if ($store.compactStore?.compacting) return 'Compaction in progress';
14 + if ($store.chatInput?.running) return 'Cannot compact while agent is running';
15 return 'Compact chat history into a single summary';
16 }
17 }">