feat: ContentGuardianAgent, onboarding UX, Team Activity action wiring, docs, agent help modal
ContentGuardianAgent consolidation:
- Merge 3 duplicate classes into single source in specialized/content_guardian.py
- Watchdog audit_committee() with heuristic scoring, coverage gaps, overlaps, alerts
- Remove misleading rejection_rate() helper; use acceptance_rate directly
- Integrate audit + alerts + trend signals into today_workflow_service.py
Team Activity page:
- QualityAuditPanel: health ring, per-agent critiques, coverage gaps, overlaps
- TrendSignalsPanel: opportunity cards with urgency/impact/coverage bars
- AlertBanner: persistent dismiss via POST /alerts/{id}/mark-read
- AgentHelpModal: dialog showing all 8 agents with descriptions, tools, schedule
- QualityAuditPanel action buttons: Fill gap -> /content-planning, Resolve overlap, View CTA on alerts/issues
- TrendSignalsPanel action buttons: Create content from this trend -> /blog-writer with trend context state
Onboarding system:
- Step 4 validation: no auto-pass via basic_ready; requires persona data or explicit progression
- Step 5 validation: logs warning on auto-pass without integration data
- OnboardingCompletionService: single DB session, transactional task creation, upsert pattern
- Business-without-website: nullable website_url on SIFIndexingTask and MarketTrendsTask
- DeepCompetitorAnalysisExecutor: 5-min timeout, 10-competitor cap, asyncio.wait_for
- Persona generation: async with 30s timeout, falls back to scheduler
- OnboardingProgressService.reset_onboarding(): resets session + pauses all DB tasks
- OnboardingControlService.reset_onboarding(): also cancels APScheduler jobs
- FinalStep TaskSchedulingPanel: shows scheduled/failed tasks after completion, 8s auto-redirect
- onboarding_completed agent activity event logged to feed
Documentation:
- docs-site/features/onboarding/: overview, steps, scheduler-tasks, technical-reference (4 pages)
- docs-site/mkdocs.yml: added Onboarding System nav section
- docs-site/features/sif-agents/: overview, agent-directory, committee-system, content-guardian (4 pages)
- docs-site/features/team-activity/: overview, quality-audit, trend-signals, alert-system (4 pages)
- docs-site/features/todays-workflow/: updated overview, technical-architecture, workflow-guide, api-reference
This commit is contained in:
@@ -168,3 +168,74 @@ class OnboardingProgressService:
|
||||
except Exception as e:
|
||||
logger.error(f"Error completing onboarding: {e}")
|
||||
return False
|
||||
|
||||
def reset_onboarding(self, user_id: str) -> bool:
|
||||
"""Reset onboarding progress and cancel/pause all scheduled tasks for the user."""
|
||||
try:
|
||||
db = get_session_for_user(user_id)
|
||||
try:
|
||||
# Reset the onboarding session
|
||||
session = db.query(OnboardingSession).filter(OnboardingSession.user_id == user_id).first()
|
||||
if session:
|
||||
session.current_step = 1
|
||||
session.progress = 0.0
|
||||
session.updated_at = datetime.utcnow()
|
||||
db.commit()
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
# Cancel/pause all scheduled tasks for this user
|
||||
self._cancel_scheduled_tasks(user_id)
|
||||
|
||||
logger.info(f"Reset onboarding for user {user_id}")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"Error resetting onboarding for user {user_id}: {e}")
|
||||
return False
|
||||
|
||||
def _cancel_scheduled_tasks(self, user_id: str):
|
||||
"""Pause all DB-backed scheduled tasks for a user after onboarding reset."""
|
||||
try:
|
||||
from models.website_analysis_monitoring_models import (
|
||||
OnboardingFullWebsiteAnalysisTask,
|
||||
DeepCompetitorAnalysisTask,
|
||||
SIFIndexingTask,
|
||||
MarketTrendsTask,
|
||||
WebsiteAnalysisTask,
|
||||
)
|
||||
from models.advertools_monitoring_models import AdvertoolsTask
|
||||
|
||||
db = get_session_for_user(user_id)
|
||||
try:
|
||||
task_models = [
|
||||
OnboardingFullWebsiteAnalysisTask,
|
||||
DeepCompetitorAnalysisTask,
|
||||
SIFIndexingTask,
|
||||
MarketTrendsTask,
|
||||
WebsiteAnalysisTask,
|
||||
]
|
||||
try:
|
||||
task_models.append(AdvertoolsTask)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
paused_count = 0
|
||||
for model_cls in task_models:
|
||||
try:
|
||||
active_tasks = db.query(model_cls).filter(
|
||||
model_cls.user_id == user_id,
|
||||
model_cls.status == "active"
|
||||
).all()
|
||||
for task in active_tasks:
|
||||
task.status = "paused"
|
||||
paused_count += 1
|
||||
except Exception as e:
|
||||
logger.warning(f"Could not pause {model_cls.__tablename__} tasks for user {user_id}: {e}")
|
||||
|
||||
db.commit()
|
||||
if paused_count > 0:
|
||||
logger.info(f"Paused {paused_count} scheduled tasks for user {user_id} after onboarding reset")
|
||||
finally:
|
||||
db.close()
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to cancel scheduled tasks for user {user_id}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user