feat: FlowPilot AI — Phases 4 & 5 (Gallery, Export, Responsive, Enterprise, Analytics) #116

Merged
chihlasm merged 66 commits from feat/flowpilot-ai-session into main 2026-03-21 05:15:51 +00:00
2 changed files with 17 additions and 5 deletions
Showing only changes of commit a7b916116d - Show all commits

View File

@@ -406,14 +406,19 @@ async def get_escalation_queue(
db: Annotated[AsyncSession, Depends(get_db)],
_: None = Depends(require_engineer_or_admin),
):
"""List sessions requesting escalation for the current user's team."""
if not current_user.team_id:
"""List sessions requesting escalation for the current user's team/account."""
# Match by team_id if available, otherwise fall back to account_id
if current_user.team_id:
scope_filter = AISession.team_id == current_user.team_id
elif current_user.account_id:
scope_filter = AISession.account_id == current_user.account_id
else:
return []
result = await db.execute(
select(AISession)
.where(
AISession.team_id == current_user.team_id,
scope_filter,
AISession.status == "requesting_escalation",
)
.order_by(AISession.created_at.desc())

View File

@@ -147,13 +147,20 @@ async def get_sidebar_stats(
for row in recent_result.all()
]
# --- Escalation count (team-wide pending escalations) ---
# --- Escalation count (team/account-wide pending escalations) ---
escalation_count = 0
if current_user.team_id:
esc_scope = AISession.team_id == current_user.team_id
elif current_user.account_id:
esc_scope = AISession.account_id == current_user.account_id
else:
esc_scope = None
if esc_scope is not None:
esc_result = await db.execute(
select(func.count()).where(
and_(
AISession.team_id == current_user.team_id,
esc_scope,
AISession.status == "requesting_escalation",
)
)