Skip to content

Commit

Permalink
feat: Updated gptme/cli.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Mar 22, 2024
1 parent e256fc9 commit b45384d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gptme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
is_flag=True,
help="Show version.",
)
@click.option(
'--list-conversations', is_flag=True, help='List past conversations.'
)
def main(
prompts: list[str],
prompt_system: str,
Expand All @@ -119,6 +122,7 @@ def main(
verbose: bool,
no_confirm: bool,
interactive: bool,
list_conversations: bool,
show_hidden: bool,
version: bool,
):
Expand Down Expand Up @@ -202,7 +206,7 @@ def chat(

# we need to run this before checking stdin, since the interactive doesn't work with the switch back to interactive mode
logfile = get_logfile(
name, interactive=(not prompt_msgs and interactive) and sys.stdin.isatty()
name, interactive=(not prompt_msgs and interactive) and sys.stdin.isatty(), list_conversations=list_conversations
)
print(f"Using logdir {logfile.parent}")
log = LogManager.load(logfile, initial_msgs=initial_msgs, show_hidden=show_hidden)
Expand Down Expand Up @@ -339,7 +343,7 @@ def get_name(name: str) -> Path:
return logpath


def get_logfile(name: str, interactive=True) -> Path:
def get_logfile(name: str, interactive=True, list_conversations: bool = False) -> Path:
# let user select between starting a new conversation and loading a previous one
# using the library
title = "New conversation or load previous? "
Expand Down

0 comments on commit b45384d

Please sign in to comment.