From c163414ecd658928965c0e264d41cd3334e1ed4d Mon Sep 17 00:00:00 2001 From: DaniDuese Date: Mon, 30 Oct 2023 14:21:53 +0100 Subject: [PATCH 1/4] Add "/del-all" to clear all conversations --- src/hugchat/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hugchat/cli.py b/src/hugchat/cli.py index 236bf8f..4c120fb 100644 --- a/src/hugchat/cli.py +++ b/src/hugchat/cli.py @@ -163,6 +163,13 @@ def cli(): except ValueError: print("# Please enter a valid ID number") + elif question.startswith("/del-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}{' ' if chatbot.current_conversation == i else ''}") for i in From 3b8faa916483bfbb6d6601b0e72ecb898937945d Mon Sep 17 00:00:00 2001 From: DaniDuese Date: Mon, 30 Oct 2023 14:24:56 +0100 Subject: [PATCH 2/4] More fixes --- src/hugchat/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hugchat/cli.py b/src/hugchat/cli.py index 4c120fb..2d4b977 100644 --- a/src/hugchat/cli.py +++ b/src/hugchat/cli.py @@ -163,7 +163,7 @@ def cli(): except ValueError: print("# Please enter a valid ID number") - elif question.startswith("/del-all"): + elif question.startswith("/clear-conversations"): try: chatbot.delete_all_conversations() print("# All conversations successfully deleted") @@ -224,6 +224,7 @@ def cli(): "/ids : Shows a list of all ID numbers and ID strings in current session.\n" "/switch : Switches to the ID number or ID string passed.\n" "/del : Deletes the ID number or ID string passed. Will not delete active session.\n" + "/clear-conversations : [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 : Switches model to given model index based on /llm.\n" From 6e264f12d013feb5abf7ef92172ae724a1e68acf Mon Sep 17 00:00:00 2001 From: DaniDuese Date: Mon, 30 Oct 2023 14:30:05 +0100 Subject: [PATCH 3/4] Fixes --- src/hugchat/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hugchat/cli.py b/src/hugchat/cli.py index 2d4b977..37e92d0 100644 --- a/src/hugchat/cli.py +++ b/src/hugchat/cli.py @@ -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 "" @@ -163,7 +163,7 @@ def cli(): except ValueError: print("# Please enter a valid ID number") - elif question.startswith("/clear-conversations"): + elif question == "/delete-all": try: chatbot.delete_all_conversations() print("# All conversations successfully deleted") @@ -224,7 +224,7 @@ def cli(): "/ids : Shows a list of all ID numbers and ID strings in current session.\n" "/switch : Switches to the ID number or ID string passed.\n" "/del : Deletes the ID number or ID string passed. Will not delete active session.\n" - "/clear-conversations : [DANGER] Deletes all the conversations for the logged in user.\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 : Switches model to given model index based on /llm.\n" From 844c3b18d83e49c88ee82a5216ac34429457f963 Mon Sep 17 00:00:00 2001 From: DaniDuese Date: Tue, 31 Oct 2023 12:19:47 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4a8386e..d208c93 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ Commands in cli mode: - `/ids` : Shows a list of all ID numbers and ID strings in current session. - `/switch ` : Switches to the ID number or ID string passed. - `/del ` : 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 ` : Switches model to given model index based on `/llm`.