-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: add guards to session management #101
Conversation
rich's parser gets confused when there's a color string so we need to add a space otherwise the coloring ends up getting mashed.
src/goose/cli/session.py
Outdated
@@ -140,13 +140,45 @@ def process_first_message(self) -> Optional[Message]: | |||
return Message.user(text=user_input.text) | |||
return self.exchange.messages.pop() | |||
|
|||
def prompt_overwrite_session(self) -> None: | |||
print(f"[yellow]session already exists at {self.session_file_path}.[/]\n") | |||
print("would like to overwrite the existing session?") |
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.
could use a second opinion on this menu, is there a way we can improve the ux?
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.
renamed this function to _prompt_overwrite_session
in a1c8c82 (still could use the feedback)
src/goose/cli/session.py
Outdated
self.prompt_overwrite_session() | ||
|
||
print( | ||
f"[bold]starting session | name: [cyan]{self.name}[/] profile: [cyan]{self.profile or 'default'}[/][/bold]" |
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.
@lifeizhou-ap i added some screenshots in the body of the PR to to make this bold since it was hard to see with dark themes on my terminal. happy to change this back!
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.
keep it dim imo! this info shows every time in case you need it but you mostly don't, so i like it being de-emphasized
88efdc0
to
a43e65e
Compare
Hi @lamchau, Nice one! I noticed that the session.py file is getting bigger. Just wondering whether it is better to separate some of these logics to another component or file? |
also I feel that with your change, we may not require |
@lifeizhou-ap maybe after we get to 500 lines or so unless you have another suggestion? 30% or so of the |
[formatted for clarity] @lifeizhou-ap possibly! but the challenge lies in how it's invoked in this project and internally as a subcommand and how it's used via
with
if we keep the command anyhoo, those are my thoughts/biases - we should go with whatever flow makes the most sense. since it's a product decision, maybe anna can make the call? |
I see. Personally I prefer small files for readability and maintenance. However, I understand your concern and we can refactor in the future when it reaches the point for refactoring. One suggestion: Maybe extract the code into a function?
|
Hey @baxen I am happy with this PR (only with a small suggestion). Would you like to review it? |
@lifeizhou-ap sure thing, extracted and reordered them here a1c8c82 |
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.
LGTM
src/goose/cli/session.py
Outdated
self.prompt_overwrite_session() | ||
|
||
print( | ||
f"[bold]starting session | name: [cyan]{self.name}[/] profile: [cyan]{self.profile or 'default'}[/][/bold]" |
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.
keep it dim imo! this info shows every time in case you need it but you mostly don't, so i like it being de-emphasized
@baxen it's pretty hard to see dim magenta, it'd be friendlier imo if we either keep it the same gray color and not emphasize it with color at all. or alternatively we don't display the file location at all? |
+1 to not needing tho show the file location at all here |
20dec22
to
93859ed
Compare
82058e1
to
f8fce2f
Compare
* main: feat: add groq provider (#134) feat: add a deep thinking reasoner model (o1-preview/mini) (#68) fix: use concrete SessionNotifier (#135) feat: add guards to session management (#101) fix: Set default model configuration for the Google provider. (#131) test: convert Google Gemini tests to VCR (#118) chore: Add goose providers list command (#116) docs: working ollama for desktop (#125) docs: format and clean up warnings/errors (#120) docs: update deploy workflow (#124) feat: Implement a goose run command (#121)
added a fix/workaround for
rich
color handlingswitched
[dim]
to[bold]
for dark terminalsadded a cleanup for empty sessions: edge case when a user aborts early - without it empty sessions are generated so we're unable to find the "right" last valid session to resume
added a prompt menu for overwrites: added a check for existing session files and give a user an opportunity to recover before they take a destructive action
note: the image shows both the empty session file (
goose session list
doesn't containabcd.jsonl
) and what the menu ux looks like for a session conflict