Conversation
|
Automatic saving could use a signal when messages list is updated or a single message is updated (jupyterlab/jupyter-chat#389). |
…nd fix restoration when moving chats
|
Thanks @brichet. Trying on the RTD demo, it seems the chats are not restored after reloading the page: jupyterlite-ai-saved-chat.mp4And there seems to be an error when trying to restore the chat manually, even though it appears in jupyterlite-ai-chat-restore.mp4 |
Wondering if it could make sense for This would help make the UX similar to the one in Although such files would then not be usable across these projects , while they look the same and end with |
|
Thanks for trying, I haven't tested it on RTD.
Good point 👍 . |
…erlab-chat for compatibility
|
It should be fixed now, and the chat format is compatible with |
| attachments | ||
| }; | ||
| }); | ||
| this.clearMessages(); |
There was a problem hiding this comment.
Right, I wonder what policy we should adopt regarding context history, especially now that chats can be restored. This could cause the context to contain too much messages.
There was a problem hiding this comment.
I added a commit to restore the agent history for now.
| export function SaveComponent(props: ISaveButtonProps): JSX.Element { | ||
| const { model, translator: trans } = props; | ||
|
|
||
| const [autosave, setAutosave] = useState(model.autosave); |
There was a problem hiding this comment.
Does this properly pick up the new state when the restore() method (setting the value of autosave) is called in the chat model?
There was a problem hiding this comment.
It actually did, but it may be a race condition. Let's add a signal to handle it properly.
There was a problem hiding this comment.
Done, the autosave state depends on the model state now.
| "items": { "type": "string" }, | ||
| "default": [".agents/skills", "_agents/skills"] | ||
| }, | ||
| "chatBackupDirectory": { |
There was a problem hiding this comment.
Wondering if we need this new directory? Or should just handle .chat files as regular files like in jupyter-chat?
There could still be a setting to decided whether or not to enable the saving / auto-saving of such files.
There was a problem hiding this comment.
I don't have a strong opinion on it, maybe we could keep the option in settings but set it to the root directory by default.
There was a problem hiding this comment.
Done, default to root directory, but it is still configurable in settings.

This PR add commands and buttons to save and restore chats.
Fixe #299
In the current state, the chats are JSON serialized and save as a file in a
hiddendirectory.Saving can be done manually with the toolbar button, or automatically with the small button next to the save button
. The automatic save is triggered when messages list updated, with a 3s debouncer to avoid triggering several times during streaming.
Restoring is done automatically from the chat name when restoring the session, and can also be done manually using the commands (a file is then required).
(auto)save and auto restoration
output.webm
manual restoration
output.webm
To do
disable the command when restoration is not possible@jupyter/chat