-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Conversation
There was a problem hiding this 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': |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
* Initial draft of /clear command. * Finish implementation of /clear. * Remove extra console.log.
* Initial draft of /clear command. * Finish implementation of /clear. * Remove extra console.log.
This PR adds a /clear command that clears the chat history, but leaves the memory intact.