Fix AI assignment returning nothing: cap tokens, optimize prompt, show errors
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m32s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m32s
- Cap maxTokens at 12000 (was unlimited dynamic calc that could exceed model limits) - Replace massive EXISTING array with compact CURRENT_JUROR_LOAD counts and ALREADY_ASSIGNED per-project map (keeps prompt small across batches) - Add coverage gap-filler: algorithmically fills projects below required reviews - Show error state inline on page when AI fails (red banner with message) - Add server-side logging for debugging assignment flow - Reduce batch size to 10 projects Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -186,7 +186,8 @@ export default function RoundDetailPage() {
|
||||
})
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`AI generation failed: ${err.message}`)
|
||||
toast.error(`AI generation failed: ${err.message}`, { duration: 15000 })
|
||||
console.error('[AI Assignment]', err)
|
||||
},
|
||||
})
|
||||
const [exportOpen, setExportOpen] = useState(false)
|
||||
@@ -1725,6 +1726,19 @@ export default function RoundDetailPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{aiAssignmentMutation.error && !aiAssignmentMutation.isPending && (
|
||||
<div className="flex items-center gap-3 p-3 rounded-lg bg-red-50 border border-red-200 dark:bg-red-950/20 dark:border-red-800">
|
||||
<AlertTriangle className="h-5 w-5 text-red-600 shrink-0" />
|
||||
<div className="flex-1">
|
||||
<p className="text-sm font-medium text-red-800 dark:text-red-200">
|
||||
AI generation failed
|
||||
</p>
|
||||
<p className="text-xs text-red-600 dark:text-red-400">
|
||||
{aiAssignmentMutation.error.message}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{aiAssignmentMutation.data && !aiAssignmentMutation.isPending && (
|
||||
<div className="flex items-center gap-3 p-3 rounded-lg bg-emerald-50 border border-emerald-200 dark:bg-emerald-950/20 dark:border-emerald-800">
|
||||
<CheckCircle2 className="h-5 w-5 text-emerald-600 shrink-0" />
|
||||
|
||||
Reference in New Issue
Block a user