diff --git a/server/focal-point.ts b/server/focal-point.ts index c3cde95..26d3f73 100644 --- a/server/focal-point.ts +++ b/server/focal-point.ts @@ -9,6 +9,10 @@ const openai = new OpenAI({ const cache = new Map(); +const manualOverrides: Record = { + "/uploads/70-jahre-oberkrainer.webp": { x: 50, y: 55 }, +}; + const SYSTEM_PROMPT = `You are an image analysis tool that detects where faces and people are located in photographs. Analyze the image and find the PRIMARY person or group of people. Report the CENTER of their face(s) as x,y percentages. - x=0 means far left edge, x=100 means far right edge @@ -25,6 +29,10 @@ Return ONLY a JSON object like {"x":42,"y":38} with no other text.`; export async function analyzeFocalPoint(imagePath: string): Promise<{ x: number; y: number }> { const originalPath = imagePath; + if (manualOverrides[originalPath]) { + cache.set(originalPath, manualOverrides[originalPath]); + return manualOverrides[originalPath]; + } if (cache.has(originalPath)) { return cache.get(originalPath)!; }