Add session persistence for Gemini#443
Conversation
|
This is looking great. A few things we should think more about:
|
|
I think from UX point of view, if I load an existing session (or if that is the default behavior), the UX should give a hint saying it is using persisted session (or resuming) with something so that user know that it is not a brand new session in case they wanted to have a brand new. |
db949d6 to
0b83d8c
Compare
After this is merged, default behavior should continue as normal. To use sessions, users will need to opt in with --new-session or -session flags.
After this is merged, if someone tries to use another provider without session flags, things work as before. If they try to an unsupported provider with session flags, it will return an error on startup about session persistence being not yet implemented for that provider.
After this is merged, if an existing session is loaded, there will be a welcome back message with a hint to use --new-session if they don't want to continue last session. I've updated PR description and provided demos. |
droot
left a comment
There was a problem hiding this comment.
Thanks @noahlwest
This is looking quite good. I have a few comments that probably can simplify a few things. But if it is complicating the implementation, lets discuss.
| mcpManager *mcp.Manager | ||
|
|
||
| // ChatMessageStore is the underlying session persistence layer. | ||
| ChatMessageStore api.ChatMessageStore |
There was a problem hiding this comment.
Just thinking:
we can define the interface here (closer to the user of the interface) and also enforce here that pkg/sessions/Session implements the interface.
Thanks for sharing the demos, they really helped in seeing the UX. Looking very good. |
eea2f70 to
3b184e6
Compare
Add `session` metaquery command
… using session flags
…a section explaining the added flags -renamed SessionID `--session` to ResumeSession `--resume-session` -fixed edge case and cleaned up tech debt in conversation.go and terminal.go -removed unused fields in session.go
3b184e6 to
c460019
Compare
droot
left a comment
There was a problem hiding this comment.
This is awesome. I was about to merge it, but then found a few nits that can potentially simplify the code even further. We can do it in a follow up as well if you prefer. happy to discuss over gvc if that can help resolve this faster.
droot
left a comment
There was a problem hiding this comment.
Thanks for working through this. Looks great, getting it in.
Adds session persistence for gemini, so users can continue where they left off, or continue their session in a different interface.
To try it out, use
kubectl-ai --new-sessionto start a new session, andkubectl-ai --session <session id>to resume a session. If you don't know your session id, you can usekubectl-ai sessionsto list them.demo showing session persistence from terminal -> terminal -> web: https://github.com/user-attachments/assets/1e73d9bf-b1d9-4165-985c-67dfe7c5a708
demo showing loading different sessions: https://github.com/user-attachments/assets/c8b2d6c7-3833-485a-9bfd-7bb228c203e9
demo showing behavior without session flags (same as today) and trying to use sessions on unsupported providers: https://github.com/user-attachments/assets/5edcf484-f5f1-4125-9de8-8460af14a543