AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Update message_agent function to support string keys
slavakurilyakb418861d7039
diff --git a/scripts/commands.py b/scripts/commands.pyindex c1d5db9d30..2adb84cf50 100644--- a/scripts/commands.py+++ b/scripts/commands.py@@ -256,18 +256,20 @@ def start_agent(name, task, prompt, model=cfg.fast_llm_model):def message_agent(key, message):global cfg-+# Check if the key is a valid integer- if not is_valid_int(key):- return "Invalid key, cannot message agent."-- agent_response = agents.message_agent(int(key), message)+ if is_valid_int(key):+ agent_response = agents.message_agent(int(key), message)+ # Check if the key is a valid string+ elif isinstance(key, str):+ agent_response = agents.message_agent(key, message)+ else:+ return "Invalid key, must be an integer or a string."# Speak responseif cfg.speak_mode:- speak.say_text(agent_response, 1)-- return f"Agent {key} responded: {agent_response}"+ say.speak(agent_response)+ return agent_responsedef list_agents():