Skip to content

Commit

Permalink
Refactor command execution logic in chatbot_with_streaming.py
Browse files Browse the repository at this point in the history
  • Loading branch information
herumes committed Jun 6, 2024
1 parent e6fb116 commit 0880c82
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions examples/chatbot_with_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,21 @@ def is_command(self, input: str) -> bool:

def execute_command(self, input: str) -> None:
command = self.get_command(input)
if command in ["/exit", "/quit"]:
self.exit()
elif command == "/help":
self.opening_instructions()
elif command == "/new":
self.new_chat()
elif command == "/model":
self.switch_model(input)
elif command == "/system":
self.switch_system_message(input)
elif command == "/config":
self.show_config()
elif command == "/download":
self.download_conversation(input)
match command:
case "/exit" | "/quit":
self.exit()
case "/help":
self.opening_instructions()
case "/new":
self.new_chat()
case "/model":
self.switch_model(input)
case "/system":
self.switch_system_message(input)
case "/config":
self.show_config()
case "/download":
self.download_conversation(input)

def download_conversation(self, input: str) -> None:
format = self.get_arguments(input).lower()
Expand Down

0 comments on commit 0880c82

Please sign in to comment.