diff --git a/src/app/(admin)/admin/rounds/[id]/assignments/page.tsx b/src/app/(admin)/admin/rounds/[id]/assignments/page.tsx index 5c2c1a1..c8b4794 100644 --- a/src/app/(admin)/admin/rounds/[id]/assignments/page.tsx +++ b/src/app/(admin)/admin/rounds/[id]/assignments/page.tsx @@ -76,15 +76,40 @@ function AssignmentManagementContent({ roundId }: { roundId: string }) { const [manualDialogOpen, setManualDialogOpen] = useState(false) const [selectedJuror, setSelectedJuror] = useState('') const [selectedProject, setSelectedProject] = useState('') + const [useAI, setUseAI] = useState(false) const { data: round, isLoading: loadingRound } = trpc.round.get.useQuery({ id: roundId }) const { data: assignments, isLoading: loadingAssignments } = trpc.assignment.listByRound.useQuery({ roundId }) const { data: stats, isLoading: loadingStats } = trpc.assignment.getStats.useQuery({ roundId }) - const { data: suggestions, isLoading: loadingSuggestions, refetch: refetchSuggestions } = trpc.assignment.getSuggestions.useQuery( + const { data: isAIAvailable } = trpc.assignment.isAIAvailable.useQuery() + + // Algorithmic suggestions (default) + const { data: algorithmicSuggestions, isLoading: loadingAlgorithmic, refetch: refetchAlgorithmic } = trpc.assignment.getSuggestions.useQuery( { roundId }, - { enabled: !!round } + { enabled: !!round && !useAI } ) + // AI-powered suggestions + const { data: aiSuggestionsRaw, isLoading: loadingAI, refetch: refetchAI } = trpc.assignment.getAISuggestions.useQuery( + { roundId, useAI: true }, + { enabled: !!round && useAI } + ) + + // Normalize AI suggestions to match algorithmic format + const aiSuggestions = aiSuggestionsRaw?.suggestions?.map((s) => ({ + userId: s.jurorId, + jurorName: s.jurorName, + projectId: s.projectId, + projectTitle: s.projectTitle, + score: Math.round(s.confidenceScore * 100), + reasoning: [s.reasoning], + })) ?? [] + + // Use the appropriate suggestions based on mode + const suggestions = useAI ? aiSuggestions : (algorithmicSuggestions ?? []) + const loadingSuggestions = useAI ? loadingAI : loadingAlgorithmic + const refetchSuggestions = useAI ? refetchAI : refetchAlgorithmic + // Get available jurors for manual assignment const { data: availableJurors } = trpc.user.getJuryMembers.useQuery( { roundId }, @@ -111,6 +136,7 @@ function AssignmentManagementContent({ roundId }: { roundId: string }) { utils.assignment.listByRound.invalidate({ roundId }) utils.assignment.getStats.invalidate({ roundId }) utils.assignment.getSuggestions.invalidate({ roundId }) + utils.assignment.getAISuggestions.invalidate({ roundId }) setSelectedSuggestions(new Set()) }, }) @@ -438,24 +464,40 @@ function AssignmentManagementContent({ roundId }: { roundId: string }) {
- Smart Assignment Suggestions + {useAI ? 'AI Assignment Suggestions' : 'Smart Assignment Suggestions'} - AI-powered recommendations based on expertise matching and workload - balance + {useAI + ? 'GPT-powered recommendations analyzing project descriptions and judge expertise' + : 'Algorithmic recommendations based on tag matching and workload balance'}
- +
+ + +
diff --git a/src/components/settings/settings-content.tsx b/src/components/settings/settings-content.tsx index 5dec6db..5590d3f 100644 --- a/src/components/settings/settings-content.tsx +++ b/src/components/settings/settings-content.tsx @@ -18,7 +18,11 @@ import { Shield, Settings as SettingsIcon, Bell, + Tags, + ExternalLink, } from 'lucide-react' +import Link from 'next/link' +import { Button } from '@/components/ui/button' import { AISettingsForm } from './ai-settings-form' import { AIUsageCard } from './ai-usage-card' import { BrandingSettingsForm } from './branding-settings-form' @@ -110,11 +114,15 @@ export function SettingsContent({ initialSettings }: SettingsContentProps) { return ( - + AI + + + Tags + Branding @@ -156,6 +164,38 @@ export function SettingsContent({ initialSettings }: SettingsContentProps) { + + + + + + Expertise Tags + + + Manage tags used for jury expertise, project categorization, and AI-powered matching + + + +

+ Expertise tags are used across the platform to: +

+
    +
  • Categorize jury members by their areas of expertise
  • +
  • Tag projects for better organization and filtering
  • +
  • Power AI-based project tagging
  • +
  • Enable smart jury-project matching
  • +
+ +
+
+
+