Add functionality to extend the session indefinitely - #10
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to extend Gemini Live sessions indefinitely by implementing session resumption and automatic reconnection when "go away" signals are received. The changes enable the system to maintain conversation context across session boundaries while handling service interruptions gracefully.
- Adds context window compression and session resumption configurations to the Gemini Live client
- Refactors session management to use a Ref-based approach enabling dynamic session replacement
- Implements automatic session resumption logic when receiving "go away" signals from the Gemini API
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| GeminiLiveConfigBuilder.scala | Adds context window compression and session resumption configuration options |
| GeminiIO.scala | Refactors session handling to use Ref[IO, AsyncSession] and adds session resumption functionality |
| GeminiService.scala | Implements go-away signal handling and automatic session resumption with activity state preservation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| .sessionResumption( | ||
| SessionResumptionConfig | ||
| .builder() | ||
| .handle(handle.getOrElse("")) |
There was a problem hiding this comment.
Using getOrElse(\"\") for the handle parameter could be problematic. Consider using handle.orNull or checking if the SessionResumptionConfig should only be set when a handle is provided, as an empty string might not be a valid handle value.
GeminiLiveConfigBuilder
Gemini IO
AsyncSession->sessionRef: Ref[IO, AsyncSession]Gemini Service