Make Ollama prompt editable in admin AI settings
- Add prompt column to ai_settings (migration) - AiSetting: DEFAULT_PROMPT constant + getActivePrompt() (falls back to default if empty) - ProcessNailPolishImage: reads prompt from DB instead of hardcoded - Admin view: textarea to edit prompt, shows active prompt, reset-to-default link Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2677ee6f39
commit
f60221d0ef
@@ -33,20 +33,7 @@ class ProcessNailPolishImage implements ShouldQueue
|
||||
$ai = AiSetting::get();
|
||||
$imageB64 = base64_encode(Storage::disk('public')->get($import->image_path));
|
||||
|
||||
$prompt = <<<PROMPT
|
||||
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 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')"
|
||||
}
|
||||
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;
|
||||
$prompt = $ai->getActivePrompt();
|
||||
|
||||
$response = Http::timeout(160)->post("{$ai->ollama_url}/api/generate", [
|
||||
'model' => $ai->ollama_model,
|
||||
|
||||
Reference in New Issue
Block a user