Skip to content

Commit

Permalink
handle no agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jan 14, 2025
1 parent 98d7faf commit 5fb84d8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions agixt/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,9 @@ def get_agent_config(self):
)
.first()
)
self.agent_id = str(agent.id) if agent else None
if not agent:
# Check if it is a global agent
global_user = session.query(User).filter(User.email == DEFAULT_USER).first()
agent = (
session.query(AgentModel)
.filter(
AgentModel.name == self.agent_name,
AgentModel.user_id == global_user.id,
)
.first()
)
raise HTTPException(status_code=404, detail="Agent not found.")
config = {"settings": {}, "commands": {}}
if agent:
all_commands = session.query(Command).all()
Expand Down

0 comments on commit 5fb84d8

Please sign in to comment.