Skip to content

Commit

Permalink
Merge pull request #134 from DaniEnsi/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter authored Oct 31, 2023
2 parents cc183e8 + 844c3b1 commit c1c031a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Commands in cli mode:
- `/ids` : Shows a list of all ID numbers and ID strings in current session.
- `/switch <id>` : Switches to the ID number or ID string passed.
- `/del <id>` : Deletes the ID number or ID string passed. Will not delete active session.
- `/delete-all` : Deletes all the conversations for the logged in user.
- `/clear` : Clear the terminal.
- `/llm` : Get available models you can switch to.
- `/llm <index>` : Switches model to given model index based on `/llm`.
Expand Down
10 changes: 9 additions & 1 deletion src/hugchat/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def cli():
except ValueError:
print("# Please enter a valid ID number")

elif question.startswith("/del"):
elif question.startswith("/del") & (not question == "/delete-all"):
try:
conversations = chatbot.get_conversation_list()
conversation_id = question.split(" ")[1] if len(question.split(" ")) > 1 else ""
Expand Down Expand Up @@ -163,6 +163,13 @@ def cli():
except ValueError:
print("# Please enter a valid ID number")

elif question == "/delete-all":
try:
chatbot.delete_all_conversations()
print("# All conversations successfully deleted")
except ValueError:
print("# Could not delete all conversations")

elif question == "/ids":
id_list = list(chatbot.get_conversation_list())
[print(f"# {id_list.index(i) + 1} : {i}{' <active>' if chatbot.current_conversation == i else ''}") for i in
Expand Down Expand Up @@ -217,6 +224,7 @@ def cli():
"/ids : Shows a list of all ID numbers and ID strings in current session.\n"
"/switch <id> : Switches to the ID number or ID string passed.\n"
"/del <id> : Deletes the ID number or ID string passed. Will not delete active session.\n"
"/delete-all : [DANGER] Deletes all the conversations for the logged in user.\n"
"/clear : Clear the terminal.\n"
"/llm : Get available models you can switch to.\n"
"/llm <index> : Switches model to given model index based on /llm.\n"
Expand Down

0 comments on commit c1c031a

Please sign in to comment.