diff options
| author | Abhi <[email protected]> | 2025-07-15 21:59:16 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-16 01:59:16 +0000 |
| commit | b72e3dfb43acc3faf8099fa758a4283b83f32ff6 (patch) | |
| tree | 5759c8c1b2a6aaf87aa170798d873f5d276f6e59 /packages/cli/src/ui/hooks/slashCommandProcessor.ts | |
| parent | e88b9362dcd1092de01ce8efa413b5acd89ee620 (diff) | |
migrate compress command (#4271)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/slashCommandProcessor.ts | 60 |
1 files changed, 4 insertions, 56 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 181c4980..67dbfcdd 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -169,6 +169,8 @@ export const useSlashCommandProcessor = ( refreshStatic(); }, setDebugMessage: onDebugMessage, + pendingItem: pendingCompressionItemRef.current, + setPendingItem: setPendingCompressionItem, }, session: { stats: session.stats, @@ -184,6 +186,8 @@ export const useSlashCommandProcessor = ( refreshStatic, session.stats, onDebugMessage, + pendingCompressionItemRef, + setPendingCompressionItem, ], ); @@ -599,60 +603,6 @@ export const useSlashCommandProcessor = ( }, 100); }, }, - { - name: 'compress', - altName: 'summarize', - description: 'Compresses the context by replacing it with a summary.', - action: async (_mainCommand, _subCommand, _args) => { - if (pendingCompressionItemRef.current !== null) { - addMessage({ - type: MessageType.ERROR, - content: - 'Already compressing, wait for previous request to complete', - timestamp: new Date(), - }); - return; - } - setPendingCompressionItem({ - type: MessageType.COMPRESSION, - compression: { - isPending: true, - originalTokenCount: null, - newTokenCount: null, - }, - }); - try { - const compressed = await config! - .getGeminiClient()! - // TODO: Set Prompt id for CompressChat from SlashCommandProcessor. - .tryCompressChat('Prompt Id not set', true); - if (compressed) { - addMessage({ - type: MessageType.COMPRESSION, - compression: { - isPending: false, - originalTokenCount: compressed.originalTokenCount, - newTokenCount: compressed.newTokenCount, - }, - timestamp: new Date(), - }); - } else { - addMessage({ - type: MessageType.ERROR, - content: 'Failed to compress chat history.', - timestamp: new Date(), - }); - } - } catch (e) { - addMessage({ - type: MessageType.ERROR, - content: `Failed to compress chat history: ${e instanceof Error ? e.message : String(e)}`, - timestamp: new Date(), - }); - } - setPendingCompressionItem(null); - }, - }, ]; if (config?.getCheckpointingEnabled()) { @@ -786,8 +736,6 @@ export const useSlashCommandProcessor = ( gitService, loadHistory, setQuittingMessages, - pendingCompressionItemRef, - setPendingCompressionItem, ]); const handleSlashCommand = useCallback( |
