Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Oct 21, 2024
1 parent f24d965 commit 079a7da
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions agixt/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,24 @@ def update_agent_config(self, new_config, config_key):
command = Command(name=command_name, extension_id=extension.id)
session.add(command)
session.commit()
# Debug, get list of commands to print
commands = session.query(Command).all()
for c in commands:
logging.info(f"Command: {c.name}")
logging.info(command.__dict__)
agent_command = (
session.query(AgentCommand)
.filter_by(agent_id=agent.id, command_id=command.id)
.first()
)
try:
agent_command = (
session.query(AgentCommand)
.filter_by(agent_id=agent.id, command_id=str(command.id))
.first()
)
except:
command = (
session.query(Command).filter_by(name=command_name).first()
)
try:
agent_command = (
session.query(AgentCommand)
.filter_by(agent_id=agent.id, command_id=str(command.id))
.first()
)
except:
agent_command = None
if agent_command:
agent_command.state = enabled
else:
Expand Down

0 comments on commit 079a7da

Please sign in to comment.