{% extends "base.html" %} {% block title %}Redax-WP — Prompts{% endblock %} {% block content %}

🧠 Prompt-Bibliothek

{% for p in prompts %}
{{ p.name }} {% if p.is_default %}Standard{% endif %}
{% if not p.is_default %} {% endif %}
{{ p.system_prompt[:80] }}...
{% endfor %}
{% endblock %} {% block extra_js %} function loadPrompt(id, text, name, is_default) { document.getElementById('prompt-id').value = id; document.getElementById('prompt-name').value = name; document.getElementById('prompt-text').value = text; } function newPrompt() { document.getElementById('prompt-id').value = ''; document.getElementById('prompt-name').value = ''; document.getElementById('prompt-text').value = ''; } async function savePrompt() { const r = await fetch('/api/prompts/save', {method:'POST',headers:{'Content-Type':'application/json'}, body: JSON.stringify({id: document.getElementById('prompt-id').value || null, name: document.getElementById('prompt-name').value, system_prompt: document.getElementById('prompt-text').value})}); if ((await r.json()).success) { showToast('💾 Gespeichert'); location.reload(); } } async function setDefault() { const id = document.getElementById('prompt-id').value; if (!id) { showToast('⚠️ Prompt zuerst speichern'); return; } await fetch(`/api/prompts/${id}/default`, {method:'POST'}); showToast('⭐ Als Standard gesetzt'); location.reload(); } async function deletePrompt(id) { if (!confirm('Prompt löschen?')) return; await fetch(`/api/prompts/${id}/delete`, {method:'POST'}); location.reload(); } {% endblock %}