feat: Unify AI prompts for Gemini and Mistral
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use server';
|
||||
|
||||
import { Mistral } from '@mistralai/mistralai';
|
||||
import { getSystemPrompt } from '@/lib/ai-prompts';
|
||||
import { BottleMetadataSchema, AnalysisResponse, BottleMetadata } from '@/types/whisky';
|
||||
import { createClient } from '@/lib/supabase/server';
|
||||
import { createHash } from 'crypto';
|
||||
@@ -49,21 +50,7 @@ export async function analyzeBottleMistral(base64Image: string, tags?: string[],
|
||||
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });
|
||||
const dataUrl = `data:image/jpeg;base64,${base64Data}`;
|
||||
|
||||
const prompt = `Du bist ein Whisky-Experte und OCR-Spezialist.
|
||||
Analysiere dieses Etikett präzise.
|
||||
Sprache für Beschreibungen: ${locale === 'en' ? 'Englisch' : 'Deutsch'}.
|
||||
Verfügbare Tags zur Einordnung: ${tags ? tags.join(', ') : 'Keine Tags verfügbar'}.
|
||||
|
||||
Antworte AUSSCHLIESSLICH mit gültigem JSON (kein Markdown, kein Text davor/danach):
|
||||
{
|
||||
"distillery": "Name der Brennerei (z.B. Lagavulin)",
|
||||
"name": "Exakter Name/Edition (z.B. 16 Year Old)",
|
||||
"vintage": "Jahrgang als Zahl oder null",
|
||||
"age": "Alter als Zahl oder null (z.B. 16)",
|
||||
"abv": "Alkoholgehalt als Zahl ohne % (z.B. 43)",
|
||||
"category": "Kategorie (z.B. Single Malt Scotch Whisky)",
|
||||
"search_string": "site:whiskybase.com [Brennerei] [Name] [Alter]"
|
||||
}`;
|
||||
const prompt = getSystemPrompt(tags ? tags.join(', ') : 'Keine Tags verfügbar', locale);
|
||||
|
||||
const chatResponse = await client.chat.complete({
|
||||
model: 'mistral-large-latest',
|
||||
|
||||
Reference in New Issue
Block a user