mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Update message_agent function to support string keys
This commit is contained in:
@@ -258,16 +258,18 @@ def message_agent(key, message):
|
|||||||
global cfg
|
global cfg
|
||||||
|
|
||||||
# Check if the key is a valid integer
|
# Check if the key is a valid integer
|
||||||
if not is_valid_int(key):
|
if is_valid_int(key):
|
||||||
return "Invalid key, cannot message agent."
|
agent_response = agents.message_agent(int(key), message)
|
||||||
|
# Check if the key is a valid string
|
||||||
agent_response = agents.message_agent(int(key), message)
|
elif isinstance(key, str):
|
||||||
|
agent_response = agents.message_agent(key, message)
|
||||||
|
else:
|
||||||
|
return "Invalid key, must be an integer or a string."
|
||||||
|
|
||||||
# Speak response
|
# Speak response
|
||||||
if cfg.speak_mode:
|
if cfg.speak_mode:
|
||||||
speak.say_text(agent_response, 1)
|
say.speak(agent_response)
|
||||||
|
return agent_response
|
||||||
return f"Agent {key} responded: {agent_response}"
|
|
||||||
|
|
||||||
|
|
||||||
def list_agents():
|
def list_agents():
|
||||||
|
|||||||
Reference in New Issue
Block a user