From 48e68cf9b5e76a82a319f34496d64617bedd2768 Mon Sep 17 00:00:00 2001 From: Kalki <97698934+jedan2506@users.noreply.github.com> Date: Thu, 31 Aug 2023 22:37:20 +0530 Subject: [PATCH] call logs bugs main (#1173) --- superagi/apm/call_log_helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superagi/apm/call_log_helper.py b/superagi/apm/call_log_helper.py index 8bc8c8460..85d359d4e 100644 --- a/superagi/apm/call_log_helper.py +++ b/superagi/apm/call_log_helper.py @@ -37,7 +37,7 @@ def fetch_data(self, model: str): func.sum(CallLogs.tokens_consumed), func.count(CallLogs.id), func.count(distinct(CallLogs.agent_id)) - ).filter(CallLogs.model == model).first() + ).filter(CallLogs.model == model, CallLogs.org_id == self.organisation_id).first() if result is None: return None @@ -51,7 +51,7 @@ def fetch_data(self, model: str): } # Fetch all runs for this model - runs = self.session.query(CallLogs).filter(CallLogs.model == model).all() + runs = self.session.query(CallLogs).filter(CallLogs.model == model, CallLogs.org_id == self.organisation_id).all() for run in runs: # Get agent's name using agent_id as a foreign key agent = self.session.query(Agent).filter(Agent.id == run.agent_id).first()