Improve AI import UX and recognition quality

- AJAX upload with progress bar — browser no longer blocks during upload;
  redirects to status page immediately after file transfer completes
- Improved Ollama prompt: clearly separates manufacturer (brand logo),
  product name (descriptive text) and number (article code) to fix
  misidentification like treating the product name as manufacturer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Housemann
2026-06-13 17:52:19 +02:00
co-authored by Claude Sonnet 4.6
parent f715bc4552
commit f94f53abbd
3 changed files with 107 additions and 40 deletions
+10 -6
View File
@@ -34,14 +34,18 @@ class ProcessNailPolishImage implements ShouldQueue
$imageB64 = base64_encode(Storage::disk('public')->get($import->image_path));
$prompt = <<<PROMPT
Analyze this nail polish bottle image carefully.
Extract the following data and respond ONLY with valid JSON, no other text:
You are analyzing a nail polish or nail product bottle/container image.
Extract exactly these three fields and respond ONLY with a valid JSON object, no explanation, no markdown:
{
"name": "the nail polish color name",
"number": "the product number or color code (often printed on bottle or cap)",
"manufacturer": "the brand name printed on the bottle"
"name": "the full product name or color description (e.g. 'Modeling Base Calcium Neutral Pink', 'Ruby Red', 'French White')",
"number": "the product code or article number printed on the label or cap (digits, letters, hyphens only — e.g. '12392-7', '123', 'NP-05')",
"manufacturer": "the brand or company name (the logo/brand printed on the product — e.g. 'NEONAIL', 'OPI', 'essie', 'Catrice')"
}
If a value is not visible or unclear, use null.
Rules:
- manufacturer = the brand/logo name (usually prominent on the label)
- name = the descriptive product/color name (NOT the brand)
- number = numeric or alphanumeric code (NOT the color name)
- If a value is genuinely not visible, use null
PROMPT;
$response = Http::timeout(160)->post("{$ai->ollama_url}/api/generate", [