From b126f7b9364df31001aa9d908f2ef9667e29b2c5 Mon Sep 17 00:00:00 2001 From: Josh XT Date: Mon, 13 Jan 2025 15:36:21 -0500 Subject: [PATCH] set company id if not set --- agixt/Agent.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/agixt/Agent.py b/agixt/Agent.py index c39ae4c554b8..6c84ad9529ca 100644 --- a/agixt/Agent.py +++ b/agixt/Agent.py @@ -232,6 +232,17 @@ def get_agents(user=DEFAULT_USER, company=None): if company_id and company: if company_id != company: continue + if not company_id: + auth = MagicalAuth(token=impersonate_user(user_id=str(user_data.id))) + company_id = str(auth.company_id) + # update agent settings + agent_setting = AgentSettingModel( + agent_id=agent.id, + name="company_id", + value=company_id, + ) + session.add(agent_setting) + session.commit() output.append( { "name": agent.name,