Skip to content

feat(tui): improve command history and interruption handling #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

skushagra9
Copy link

@skushagra9 skushagra9 commented Apr 29, 2025

Added up/down arrow navigation for command history, Esc+Esc cancellation and replace error with system message for interruptions

2025-04-30.11-33-21.mp4

Also modified /clear history - instead of showing blank screen, will show the intro message.
image

Add up/down arrow navigation for command history and replace error with system message for interruptions
Copy link

github-actions bot commented Apr 29, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@skushagra9
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@skushagra9
Copy link
Author

recheck

github-actions bot added a commit that referenced this pull request Apr 29, 2025
@skushagra9 skushagra9 marked this pull request as ready for review April 30, 2025 06:10
@skushagra9
Copy link
Author

@bolinfest please checkout, let me know if any improvements needed.

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skushagra9 thanks for taking the initiative! This is a good first cut, but I have quite a bit of feedback.

@@ -155,15 +178,20 @@ impl ChatWidget<'_> {
// Gracefully request application shutdown.
let _ = self.app_event_tx.send(AppEvent::ExitRequest);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I didn't realize we were supporting these things like in the TypeScript version...I think this needs to change because I don't think we should support both slash commands and q. That's independent of your PR, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change this as well, let me know if we only need "/" commands or "q" to quit it.
I prefer, we should use "/" - as we can also have an option to quit, something like this
image

.filter_map(|(idx, cell)| {
if let HistoryCell::UserPrompt { lines } = cell {
// Get the user's message from the prompt
// Assuming the message is in the second line
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do something more reliable?

@@ -232,6 +237,87 @@ impl ConversationHistoryWidget {
}
}
}

pub fn previous(&mut self) -> Option<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should have a separate struct that is associated with the BottomPane that should be managing history instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants