fix: resolve magic scan crash and implement context-aware AI languages
- Fixed SQL syntax error in magicScan caused by single quotes - Implemented dynamic locale-aware AI suggestions (Technical: EN, Custom Tags: Localized) - Updated Dexie schema to version 2 (added locale to pending_scans) - Fixed missing bottle_id in UploadQueue synchronization - Installed missing dexie dependencies via pnpm
This commit is contained in:
@@ -8,7 +8,7 @@ import { createHash } from 'crypto';
|
||||
import { trackApiUsage } from './track-api-usage';
|
||||
import { checkCreditBalance, deductCredits } from './credit-service';
|
||||
|
||||
export async function analyzeBottle(base64Image: string, tags?: string[]): Promise<AnalysisResponse> {
|
||||
export async function analyzeBottle(base64Image: string, tags?: string[], locale: string = 'de'): Promise<AnalysisResponse> {
|
||||
const supabase = createServerActionClient({ cookies });
|
||||
|
||||
if (!process.env.GEMINI_API_KEY) {
|
||||
@@ -48,7 +48,9 @@ export async function analyzeBottle(base64Image: string, tags?: string[]): Promi
|
||||
};
|
||||
}
|
||||
|
||||
const instruction = SYSTEM_INSTRUCTION.replace('{AVAILABLE_TAGS}', tags ? tags.join(', ') : 'No tags available');
|
||||
const instruction = SYSTEM_INSTRUCTION
|
||||
.replace('{AVAILABLE_TAGS}', tags ? tags.join(', ') : 'No tags available')
|
||||
.replace('{LANGUAGE}', locale === 'en' ? 'English' : 'German');
|
||||
|
||||
const result = await geminiModel.generateContent([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user