summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts13
-rw-r--r--packages/core/src/core/geminiChat.ts7
2 files changed, 18 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();
diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts
index d15f9d1a..3bba1805 100644
--- a/packages/core/src/core/geminiChat.ts
+++ b/packages/core/src/core/geminiChat.ts
@@ -290,6 +290,13 @@ export class GeminiChat {
}
/**
+ * Clears the chat history.
+ */
+ clearHistory(): void {
+ this.history = [];
+ }
+
+ /**
* Adds a new entry to the chat history.
*
* @param content - The content to add to the history.