diff options
| author | Seth Troisi <[email protected]> | 2025-06-11 13:40:44 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-11 13:40:44 -0700 |
| commit | 122678cc09131ee57dca2714bc94b039c371729b (patch) | |
| tree | 59f938b9566c9b164994d16cb92163d7268f143e /packages/cli/src | |
| parent | 7a72d255d8effec1396170306cc6be57f598a6d8 (diff) | |
clean chat history before /resume (#949)
Diffstat (limited to 'packages/cli/src')
| -rw-r--r-- | packages/cli/src/ui/hooks/slashCommandProcessor.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 8e2f2bd2..478a62a3 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -561,12 +561,21 @@ Add any other context about the problem here. return; } const chat = await config?.getGeminiClient()?.getChat(); + if (!chat) { + addMessage({ + type: MessageType.ERROR, + content: 'No chat client available to resume conversation.', + timestamp: new Date(), + }); + return; + } clearItems(); - let i = 0; + chat.clearHistory(); const rolemap: { [key: string]: MessageType } = { user: MessageType.USER, model: MessageType.GEMINI, }; + let i = 0; for (const item of conversation) { i += 1; const text = @@ -589,7 +598,7 @@ Add any other context about the problem here. } as HistoryItemWithoutId, i, ); - chat?.addHistory(item); + chat.addHistory(item); } console.clear(); refreshStatic(); |
