Feat/ai bean import enhancements#1105
Merged
graphefruit merged 7 commits intographefruit:developfrom Mar 29, 2026
Merged
Conversation
… offset Cloud AI prompt now instructs the model to calculate the roast date by subtracting the stated period from a best-before/expiration date when no explicit roast date is present but the label explicitly describes the offset (e.g. 'roasted 12 months before best before date'). The hint notes this may be stated in the local language of the label.
…bels Run OCR at 0°, 90°, and 270° for each image to detect text printed sideways on labels. Rotated-pass blocks are classified using the 0° pass height statistics as baseline and merged into the enriched text under a '--- Rotated text detected ---' section (only when rotated passes actually find text).
… classifyHeight helper
… remove noise Log prompt and response for both Apple Intelligence (in sendLLMPrompt) and Cloud LLM (in cloud-field-extraction) to make debugging easier. Suppress the deleteChat 'not implemented' error on iOS. Remove 18 verbose log calls (base64 lengths, OCR JSON dumps, photo processing progress) that cluttered output without aiding diagnosis.
…height A multi-line paragraph in small font produces a tall bounding box, causing misclassification as LARGE. Use average line height within each block as proxy for font size, falling back to block height when line data is unavailable.
- Remove no-op test asserting block texts on raw string (no layout logic exercised) - Remove subsumed rotated-section test, move hasUsefulMetadata assertion into classification loop - Modify shouldUseMetadata test to use line data, proving representative height drives decision - Extract boundingBoxHeight() to eliminate duplication in getRepresentativeHeight - Refactor createBlock to use options object instead of 7 positional params
- Strengthen rotation test to verify dimensions are swapped (4×2 → 2×4) - Include rotated pass text in rawText via extracted collectRawText() - Replace canvas context null guard with optional chaining - Collapse duplicate early-return guards in enrichWithLayoutMultiPass - Extract stripLayoutHeader() to eliminate duplicated regex
Owner
|
Thank you for the PR! Looks good to me! |
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.
This PR bundles different improvements for the AI based bean import feature: