"use client"; import { useState } from "react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; export default function AIMatchPage() { const [projectId, setProjectId] = useState(""); const [loading, setLoading] = useState(false); const [matches, setMatches] = useState([]); const [error, setError] = useState(""); async function handleMatch() { if (!projectId) return; setLoading(true); try { const res = await fetch("/api/ai/match-project", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ project_id: projectId, limit: 10 }), }); if (!res.ok) throw new Error("Ошибка при поиске совпадений"); const data = await res.json(); setMatches(data); } catch (err) { setError(err.message); } finally { setLoading(false); } } return (
← Назад

AI-матчинг

Подобрать фрилансеров

setProjectId(e.target.value)} placeholder="ID проекта" className="w-full px-4 py-3 border rounded-lg mb-4" /> {error && (
{error}
)}
{matches.length > 0 && (
{matches.map((m, i) => (

{m.name}

{(m.match_score * 100).toFixed(0)}%
{m.skills_matched.length > 0 && (

Совпадение навыков: {m.skills_matched.join(", ")}

)}
    {m.reasons.map((r, j) => (
  • • {r}
  • ))}
))}
)}
); }