feat(ai): OCR-Experten-Framing + expliziter User-Prompt
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m18s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m18s
Auf Gemini-Empfehlung: System-Instruction als OCR-Experte fuer kulinarische Dokumente, mit "Kontext-Detektiv"-Regel fuer schwer lesbare Zeichen, "[?]" fuer Unleserliches und strikter "keine Halluzination"-Regel. User-Prompt wird jetzt als eigene text-part bei jedem Call mitgeschickt (Bild + User-Prompt + bei Retry die Korrektur-Note). Inline-Schema aus dem Prompt entfernt, da es mit unserem responseSchema konfligierte (servings vs servings_default+unit, times-nested vs flat, instructions vs steps, kein note-Feld) -- das kann die beobachteten AI_FAILED-Schema-Validation-Fehler beguenstigt haben. Struktur wird jetzt ausschliesslich ueber responseSchema enforced. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { GoogleGenerativeAI } from '@google/generative-ai';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import {
|
||||
RECIPE_EXTRACTION_SYSTEM_PROMPT,
|
||||
RECIPE_EXTRACTION_USER_PROMPT,
|
||||
GEMINI_RESPONSE_SCHEMA,
|
||||
extractionResponseSchema,
|
||||
type ExtractionResponse
|
||||
@@ -84,7 +85,10 @@ async function callGemini(
|
||||
|
||||
const parts: Array<
|
||||
{ inlineData: { data: string; mimeType: string } } | { text: string }
|
||||
> = [{ inlineData: { data: imageBuffer.toString('base64'), mimeType } }];
|
||||
> = [
|
||||
{ inlineData: { data: imageBuffer.toString('base64'), mimeType } },
|
||||
{ text: RECIPE_EXTRACTION_USER_PROMPT }
|
||||
];
|
||||
if (appendUserNote) parts.push({ text: appendUserNote });
|
||||
|
||||
const result = await withTimeout(
|
||||
|
||||
Reference in New Issue
Block a user