feat: Freelancer Match — AI-матчинг, escrow, milestones, portfolio, skill-tests, verification
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""AI endpoints: матчинг, рекомендации."""
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.schemas.ai_match import AIMatchRequest, AIMatchResponse
|
||||
from app.services.ai_service import find_matches
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix="/api/ai", tags=["ai"])
|
||||
|
||||
|
||||
@router.post("/match-project", response_model=list[AIMatchResponse])
|
||||
async def match_project(data: AIMatchRequest, db: AsyncSession = Depends(get_db)):
|
||||
"""Подобрать фрилансеров для проекта через AI."""
|
||||
|
||||
matches = await find_matches(
|
||||
db=db, project_id=data.project_id, limit=data.limit, min_score=data.min_score
|
||||
)
|
||||
|
||||
return [AIMatchResponse(**m) for m in matches]
|
||||
|
||||
|
||||
@router.post("/generate-cover-letter")
|
||||
async def generate_cover_letter(project_title: str, freelancer_skills: list[str]):
|
||||
"""Сгенерировать сопроводительное письмо для заявки."""
|
||||
|
||||
# Placeholder — в продакшене вызов LLM
|
||||
return {
|
||||
"cover_letter": f"Здравствуйте! Я заинтересован в проекте '{project_title}'. Мой опыт работы с [{', '.join(freelancer_skills)}] позволяет качественно выполнить задачу."
|
||||
}
|
||||
Reference in New Issue
Block a user