New command to clear chat message history
Problem
/clear command does not clear the default and ask chat handler memory. Given that it clears the window I would expect it to clear the memory as well.
If this is intentional, consider adding a new command (perhaps /new) to refresh the chat.
Proposed Solution
Have /clear somehow call DefaultChatHandler.clear_memory and an equivalent in AskChatHandler. Would probably require altering BaseChatHandler to allow chat handlers to have access to other chat handlers. Could do so be by adding the AiExtension.settings["jai_chat_handlers"] dict as a param in BaseChatHandler.
Additional context
Related to https://github.com/jupyterlab/jupyter-ai/issues/428. Although this seems to assume /clear clears the default chat handler memory, which it does not.
In magic commands, we formerly used the -r (reset) option to remove history. This was removed in #551, when we removed message history from OpenAI providers in magic commands. We still use message history in the chat UI, so perhaps a new /reset command would be good to add.
After discussing this with my colleagues, a new command, perhaps called /reset, would be best for this use case. Thank you for opening this issue!
Hello @dlqqq, any estimation on when this would be added? If it is going to be a while I'll need to hack a workaround in the meantime.
I landed here in my search for an answer to the question: how does one clear the chat history to start a brand new interaction with the AI model? Is the only way currently to exit JupyterLab and start a brand new session? This is disruptive in my current state, where I have one notebook that I've been working over some time, with many calls via %%ai magics (and a state holding outputs from those calls), and did some side work in another notebook which involved many calls to the AI model via the chat interface. Finished with this side work, I'd like to not have a long chat history persisting in my current session when I go back to continue working on the first notebook.
Oh, following the linked issue #716 I see that I can temporarily change model for a chat reset as side effect! 😅
@dlqqq @JasonWeill Actually, instead of a /reset command, could we look toward a new convo button (+) and some convo selection/management button at the top bar next to the settings gear. This seems to be the standard, as seen in most of the other code chat assistant IDE plugins.
@michaelchia The idea of having multiple conversations, perhaps in "threads" (Slack or Discord style) or in "conversations" (ChatGPT style) has come up before, but I didn't see an issue articulating our past discussions. Could you please open a new issue with info about how you would like to see this feature? Some visual mocks or screenshots of UI concepts would help out. Thanks!