Skip to content
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

Small changes/fixes #160

Merged
merged 2 commits into from
Feb 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/hugchat/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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])
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down