Add terminal clear (#69)

This commit is contained in:
Juliette Love 2025-04-20 21:13:32 +01:00 committed by GitHub
parent d6556c5246
commit 8180ed9a68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -108,7 +108,13 @@ export const useGeminiStream = (
if (typeof query === 'string') {
setDebugMessage(`User query: ${query}`);
const maybeCommand = query.split(/\s+/)[0];
if (config.getPassthroughCommands().includes(maybeCommand)) {
if (query.trim() === 'clear') {
// This just clears the *UI* history, not the model history.
// TODO: add a slash command for that.
setDebugMessage('Clearing terminal.');
setHistory((prevHistory) => []);
return;
} else if (config.getPassthroughCommands().includes(maybeCommand)) {
// Execute and capture output
setDebugMessage(`Executing shell command directly: ${query}`);
_exec(query, (error, stdout, stderr) => {