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:
Housemann
2026-06-13 18:11:47 +02:00
co-authored by Claude Sonnet 4.6
parent 2677ee6f39
commit f60221d0ef
5 changed files with 75 additions and 16 deletions
+29 -1
View File
@@ -30,7 +30,7 @@
<div class="form-text">URL des Ollama-Containers/Servers ohne abschließenden Slash.</div>
</div>
<div class="mb-4">
<div class="mb-3">
<label class="form-label" for="ollama_model">Modell <span class="text-danger">*</span></label>
<input type="text" class="form-control @error('ollama_model') is-invalid @enderror"
id="ollama_model" name="ollama_model"
@@ -42,6 +42,28 @@
<div class="form-text">Muss ein Vision-fähiges Modell sein (z.B. <code>llama3.2-vision</code>, <code>llava</code>).</div>
</div>
<div class="mb-4">
<label class="form-label" for="prompt">
Erkennungs-Prompt
<span class="badge bg-secondary ms-1" style="font-size:.65rem;">optional</span>
</label>
<textarea class="form-control @error('prompt') is-invalid @enderror"
id="prompt" name="prompt" rows="12"
placeholder="Leer lassen für Standard-Prompt"
style="font-family: monospace; font-size: .82rem;">{{ old('prompt', $ai->prompt) }}</textarea>
@error('prompt')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">
Leer lassen um den Standard-Prompt zu verwenden.
<a href="#" onclick="resetPrompt(); return false;">Standard-Prompt einfügen</a>
</div>
<div class="mt-2 p-3" style="background:#f9fafb; border-radius:10px; border:1px solid #e5e7eb;">
<p style="font-size:.75rem; color:#6b7280; margin:0 0 6px; font-weight:600;">AKTUELL AKTIVER PROMPT:</p>
<pre style="font-size:.75rem; color:#374151; margin:0; white-space:pre-wrap; word-break:break-word;">{{ $ai->getActivePrompt() }}</pre>
</div>
</div>
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-2"></i>Speichern
</button>
@@ -69,4 +91,10 @@
</div>
</div>
@section('scripts')
<script>
function resetPrompt() {
document.getElementById('prompt').value = @json(\App\Models\AiSetting::DEFAULT_PROMPT);
}
</script>
@endsection