Skip to content
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

Add a /clear command to clear the chat history #78

Merged
merged 3 commits into from
Apr 17, 2023

Conversation

ellisonbg
Copy link
Contributor

This PR adds a /clear command that clears the chat history, but leaves the memory intact.

@ellisonbg ellisonbg added enhancement New feature or request @jupyter-ai/chatui labels Apr 17, 2023
Copy link
Collaborator

@3coins 3coins left a comment

Choose a reason for hiding this comment

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

@ellisonbg
Thanks for adding this feature.
There are some minor suggestions for improvement, but we can merge and iterate if you don't have time.


actor.process_message.remote(message)
actor.process_message.remote(message)
if command == '/clear':
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than having a special check here, should we just add this to the commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to use an actor, but we can figure out how to improve this.

@@ -247,6 +244,12 @@ async def on_message(self, message):
# broadcast the message to other clients
self.broadcast_message(message=chat_message)

# Clear the message history if given the /clear command
if chat_request.prompt.startswith('/'):
command = chat_request.prompt.split(' ', 1)[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will help to extract the split code into a utility function that can be reused everywhere, but can do this in another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

@ellisonbg ellisonbg merged commit b6d8216 into jupyterlab:main Apr 17, 2023
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Initial draft of /clear command.

* Finish implementation of /clear.

* Remove extra console.log.
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Initial draft of /clear command.

* Finish implementation of /clear.

* Remove extra console.log.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request @jupyter-ai/chatui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants