Skip to content

Commit

Permalink
Added list command
Browse files Browse the repository at this point in the history
  • Loading branch information
haseeb-heaven committed Mar 3, 2024
1 parent a460abc commit 7d93e45
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Here are the available commands:
- 🌐 `/language` - Change the language of the interpreter.
- 🧹 `/clear` - Clear the screen.
- 🆘 `/help` - Display this help message.
- 🚪 `/list` - List all the models available.
- 📝 `/version` - Display the version of the interpreter.
- 🚪 `/exit` - Exit the interpreter.
- 📜 `/log` - Toggle different modes of logging.
Expand Down
22 changes: 19 additions & 3 deletions libs/interpreter_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ def interpreter_main(self):
# Main input prompt - System and Assistant.
task = input("> ")

# Process the task.
# Command without arguments.
# EXIT - Command section.
if task.lower() == '/exit':
break

Expand Down Expand Up @@ -465,7 +464,24 @@ def interpreter_main(self):
Logger.set_verbose_mode()
display_markdown_message(f"Logger mode changed to **Verbose**.")
continue


# LIST - Command section.
elif task.lower() == '/list':
# Get the models info

# Reading all the config files in the configs folder.
configs_path = os.path.join(os.getcwd(), 'configs')
configs_files = [file for file in os.listdir(configs_path) if file.endswith('.config')]

# Removing all extensions from the list.
configs_files = [os.path.splitext(file)[0] for file in configs_files]

# Printing the models info.
print('Available models:\n')
print('\t'.join(configs_files))
print('',end='\n')
continue

# UPGRAGE - Command section.
elif task.lower() == '/upgrade':
command_output,_ = self.code_interpreter.execute_command('pip install open-code-interpreter --upgrade && pip install -r requirements.txt --upgrade')
Expand Down
1 change: 1 addition & 0 deletions libs/utility_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def display_help(self):
/history - Use history as memory.\n\
/clear - Clear the screen.\n\
/help - Display this help message.\n\
/list - List the available models.\n\
/version - Display the version of the interpreter.\n\
/log - Switch between Verbose and Silent mode.\n\
/upgrade - Upgrade the interpreter.\n\
Expand Down

0 comments on commit 7d93e45

Please sign in to comment.