From 6bd3ff02309cdb2742f50daf8a04ebf0ff0de22b Mon Sep 17 00:00:00 2001 From: Whitelisted <77711834+Whitelisted1@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:53:35 -0700 Subject: [PATCH 1/2] Update cli.py * Use arguments[0] instead of checking the userinput * Fix spacing of return variables * Add comments to continued_conv option in cli --- src/hugchat/cli.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hugchat/cli.py b/src/hugchat/cli.py index 87cdaa6..8475d1f 100644 --- a/src/hugchat/cli.py +++ b/src/hugchat/cli.py @@ -88,7 +88,6 @@ def handle_command(chatbot: ChatBot, userInput: str) -> None: except Exception as e: print(f"Error: {e}") - elif command == "del" or command == "delete": try: to_delete_conversation = chatbot.get_conversation_from_id(arguments[0]) @@ -221,7 +220,7 @@ def cli(): Continuing to use means that you accept the above point(s) """) - EMAIL, FORCE_INPUT_PASSWORD, stream_output , continued_conv = get_arguments() + EMAIL, FORCE_INPUT_PASSWORD, stream_output, continued_conv = get_arguments() # Check if the email is in the environment variables or given as an argument if EMAIL is None: @@ -257,13 +256,17 @@ def cli(): if continued_conv: ids = chatbot.get_remote_conversations(replace_conversation_list=True) - conversation_dict = {} - for i, id_string in enumerate(ids, start=1): - conversation_dict[i] = id_string + + conversation_dict = dict(enumerate(ids, start=1)) + + # delete the conversation that was initially created on chatbot init target_id = conversation_dict[1] chatbot.delete_conversation(target_id) + + # switch to the most recent remote conversation target_id = conversation_dict[2] chatbot.change_conversation(target_id) + print(f"Switched to Previous conversation with ID: {target_id}\n") while True: From 46f4101821ca4584a47fbee3ab4968678dbf432a Mon Sep 17 00:00:00 2001 From: Whitelisted <77711834+Whitelisted1@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:56:46 -0700 Subject: [PATCH 2/2] Update cli.py * Use arguments[0] instead of checking the userinput --- src/hugchat/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hugchat/cli.py b/src/hugchat/cli.py index 8475d1f..d56294d 100644 --- a/src/hugchat/cli.py +++ b/src/hugchat/cli.py @@ -66,7 +66,7 @@ def handle_command(chatbot: ChatBot, userInput: str) -> None: elif command == "switch": try: - if userInput == "/switch all": + if arguments[0] == "all": id = chatbot.get_remote_conversations(replace_conversation_list=True) else: id = chatbot.get_conversation_list()