Conversation
Updated project description and features section.
✅ Deploy Preview for gpacal-cis ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds an optional Google Gemini-based PDF analysis path to the admin results “analyze” API, and updates the client-side PDF OCR hook to treat Gemini results as a successful “digital-like” parse when available. It also updates environment variable examples and cleans up a small README formatting artifact.
Changes:
- Add a Gemini API (
GEMINI_API_KEY) parsing attempt before the existingpdf-parsedigital extraction fallback in/api/admin/results/analyze. - Update
usePDFOCRto acceptmethod: "gemini"as a successful server-side parse and reflect that in the progress message. - Document
GEMINI_API_KEYin.env.exampleand remove an extra horizontal-rule line fromREADME.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Removes an extra/errant separator line in the header area. |
| lib/hooks/usePDFOCR.ts | Treats "gemini" as a successful analysis method and updates the success message. |
| app/api/admin/results/analyze/route.ts | Adds Gemini API parsing path before pdf-parse, returning standardized results on success. |
| .env.example | Adds GEMINI_API_KEY sample entry and related comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+98
to
+103
| const filteredResults = (parsedData.results || []) | ||
| .map((r: any) => ({ | ||
| indexNumber: String(r.indexNumber).trim().toUpperCase(), | ||
| grade: String(r.grade).trim().toUpperCase(), | ||
| })) | ||
| .filter((r: any) => r.indexNumber && validGrades.has(r.grade)); |
Comment on lines
+37
to
+40
| console.log("Attempting Gemini API PDF parsing..."); | ||
| const base64Data = buffer.toString("base64"); | ||
|
|
||
| const geminiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=${process.env.GEMINI_API_KEY}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.