Persistent Browser Session Uptime cost metering/credit consumption + Posthog flags for billing v2 (#4444)
This commit is contained in:
@@ -5271,6 +5271,21 @@ class AgentDB(BaseAlchemyDB):
|
||||
|
||||
return DebugSession.model_validate(model) if model else None
|
||||
|
||||
async def get_debug_session_by_browser_session_id(
|
||||
self,
|
||||
browser_session_id: str,
|
||||
organization_id: str,
|
||||
) -> DebugSession | None:
|
||||
async with self.Session() as session:
|
||||
query = (
|
||||
select(DebugSessionModel)
|
||||
.filter_by(browser_session_id=browser_session_id)
|
||||
.filter_by(organization_id=organization_id)
|
||||
.filter_by(deleted_at=None)
|
||||
)
|
||||
model = (await session.scalars(query)).first()
|
||||
return DebugSession.model_validate(model) if model else None
|
||||
|
||||
async def get_workflow_runs_by_debug_session_id(
|
||||
self,
|
||||
debug_session_id: str,
|
||||
|
||||
@@ -948,7 +948,7 @@ class DebugSessionModel(Base):
|
||||
|
||||
debug_session_id = Column(String, primary_key=True, default=generate_debug_session_id)
|
||||
organization_id = Column(String, nullable=False)
|
||||
browser_session_id = Column(String, nullable=False)
|
||||
browser_session_id = Column(String, nullable=False, index=True)
|
||||
vnc_streaming_supported = Column(Boolean, nullable=True, server_default=sqlalchemy.true())
|
||||
workflow_permanent_id = Column(String, nullable=True)
|
||||
user_id = Column(String, nullable=True) # comes from identity vendor (Clerk at time of writing)
|
||||
|
||||
Reference in New Issue
Block a user