mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
Phase 1 - Repo Hardening: - README.md, LICENSE, SECURITY.md, CONTRIBUTING.md - GitHub Actions repo-hygiene workflow - docs/: ARCHITECTURE, DATA-MODEL, API-MAP, AGENT-MAP, DEPLOYMENT-NOTES Phase 2 - Database Models (7 new): - Company, Contact, Call, Commission, Payout, Dispute, GuaranteeClaim - Consent, Complaint, Policy, KnowledgeArticle, SectorAsset - Updated models/__init__.py with all 32+ models Phase 3 - API Surfaces (16 new route files): - companies, contacts, calls, meetings, commissions, payouts - disputes, guarantees, consents, complaints, knowledge - sectors, presentations, supervisor, admin, health - Updated router.py with all 24 route groups Phase 4 - AI Prompt Registry (18 agent contracts): - Lead Qualification, Affiliate Recruitment Evaluator, Onboarding Coach - Outreach Writer, Arabic WhatsApp, English Conversation, Voice Call - Meeting Booking, Sector Strategist, Objection Handler - Proposal Drafter, QA Reviewer, Compliance Reviewer - Knowledge Retrieval, Revenue Attribution, Fraud Reviewer - Guarantee Claim Reviewer, Management Summary Phase 5 - Communication Templates: - 15 production templates (WhatsApp, email, voice, internal) - Arabic + English variants with variable interpolation Phase 6 - Compliance Center (7 legal docs): - Privacy policy, Terms of service, Refund policy - Commission policy, Affiliate rules, Consent policy, Data protection - All PDPL-compliant, Arabic Phase 7 - Celery Workers (fully implemented): - follow_up_tasks: automated lead follow-ups with workflow execution - message_tasks: WhatsApp/email/SMS with retry logic - notification_tasks: daily reports, meeting reminders, in-app notifications - affiliate_tasks: target checking, commission calculation, weekly reports, AI outreach Phase 8 - Knowledge Base OS (8 files): - Services overview, Pricing policy, Channel policy, Meeting policy - Identity rules, Escalation rules, Hiring path, Internal SOPs https://claude.ai/code/session_01KnJgK7RwyeCvRZTRThHtfU
84 lines
2.5 KiB
Python
84 lines
2.5 KiB
Python
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from sqlalchemy import select, func
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel as Schema
|
|
|
|
from app.database import get_db
|
|
from app.api.deps import get_current_user
|
|
from app.models.user import User
|
|
from app.models.knowledge import SectorAsset, AssetType
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class PresentationResponse(Schema):
|
|
id: UUID
|
|
sector: str
|
|
asset_type: str
|
|
title: str
|
|
title_ar: Optional[str] = None
|
|
content: Optional[str] = None
|
|
content_ar: Optional[str] = None
|
|
file_url: Optional[str] = None
|
|
metadata: Optional[dict] = None
|
|
is_active: bool
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PresentationListResponse(Schema):
|
|
items: list[PresentationResponse]
|
|
total: int
|
|
page: int
|
|
per_page: int
|
|
|
|
|
|
PRESENTATION_TYPES = [
|
|
AssetType.PRESENTATION,
|
|
AssetType.ONE_PAGER,
|
|
AssetType.CASE_STUDY,
|
|
]
|
|
|
|
|
|
@router.get("", response_model=PresentationListResponse)
|
|
async def list_presentations(
|
|
sector: str = Query(None),
|
|
asset_type: str = Query(None),
|
|
page: int = Query(1, ge=1),
|
|
per_page: int = Query(20, ge=1, le=100),
|
|
current_user: User = Depends(get_current_user),
|
|
db: AsyncSession = Depends(get_db),
|
|
):
|
|
query = select(SectorAsset).where(
|
|
SectorAsset.is_active == True,
|
|
SectorAsset.asset_type.in_(PRESENTATION_TYPES),
|
|
)
|
|
if sector:
|
|
query = query.where(SectorAsset.sector == sector)
|
|
if asset_type:
|
|
query = query.where(SectorAsset.asset_type == asset_type)
|
|
|
|
total = (await db.execute(select(func.count()).select_from(query.subquery()))).scalar()
|
|
query = query.order_by(SectorAsset.created_at.desc()).offset((page - 1) * per_page).limit(per_page)
|
|
result = await db.execute(query)
|
|
items = [PresentationResponse.model_validate(a) for a in result.scalars().all()]
|
|
return PresentationListResponse(items=items, total=total, page=page, per_page=per_page)
|
|
|
|
|
|
@router.get("/by-sector", response_model=dict)
|
|
async def list_by_sector(
|
|
current_user: User = Depends(get_current_user),
|
|
db: AsyncSession = Depends(get_db),
|
|
):
|
|
result = await db.execute(
|
|
select(SectorAsset.sector, func.count(SectorAsset.id))
|
|
.where(SectorAsset.is_active == True, SectorAsset.asset_type.in_(PRESENTATION_TYPES))
|
|
.group_by(SectorAsset.sector)
|
|
.order_by(SectorAsset.sector)
|
|
)
|
|
return {"sectors": {row[0]: row[1] for row in result.all()}}
|