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:
@@ -152,6 +152,7 @@ export const roundAssignmentRouter = router({
|
||||
}
|
||||
|
||||
// Call AI service
|
||||
console.log(`[AI Assignment Router] Starting for ${projects.length} projects, ${jurors.length} jurors, ${input.requiredReviews} reviews/project, max ${maxPerJuror}/juror`)
|
||||
const result = await generateAIAssignments(
|
||||
jurors,
|
||||
projects,
|
||||
@@ -159,6 +160,7 @@ export const roundAssignmentRouter = router({
|
||||
ctx.user.id,
|
||||
input.roundId,
|
||||
)
|
||||
console.log(`[AI Assignment Router] Got ${result.suggestions.length} suggestions, success=${result.success}, fallback=${result.fallbackUsed}`)
|
||||
|
||||
// Filter out COI pairs and already-assigned pairs
|
||||
const existingPairSet = new Set(existingAssignments.map((a) => `${a.userId}:${a.projectId}`))
|
||||
|
||||
Reference in New Issue
Block a user