list_agents should return string not JSON

This commit is contained in:
Gershon Bialer
2023-04-14 21:42:54 -07:00
parent 0b4f0f5622
commit 2644bc86db
2 changed files with 5 additions and 2 deletions

View File

@@ -265,7 +265,7 @@ def message_agent(key, message):
def list_agents(): def list_agents():
"""List all agents""" """List all agents"""
return agents.list_agents() return "List of agents:\n" + "\n".join([str(x[0]) + ": " + x[1] for x in agents.list_agents()])
def delete_agent(key): def delete_agent(key):

View File

@@ -10,4 +10,7 @@ class TestCommands(unittest.TestCase):
mock.return_value = obj mock.return_value = obj
commands.start_agent("Test Agent", "chat", "Hello, how are you?", "gpt2") commands.start_agent("Test Agent", "chat", "Hello, how are you?", "gpt2")
agents = commands.list_agents() agents = commands.list_agents()
self.assertEqual(agents[0], (0,'chat')) self.assertEqual("List of agents:\n0: chat", agents)
commands.start_agent("Test Agent 2", "write", "Hello, how are you?", "gpt2")
agents = commands.list_agents()
self.assertEqual("List of agents:\n0: chat\n1: write", agents)