Spaces:
Runtime error
Runtime error
Download templates/agents/create.html from junaidte14/django-admin-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 8.92 kB
-
https://huggingface.co/spaces/junaidte14/django-admin-dashboard/resolve/main/templates/agents/create.html
- Command line
-
hf download hf://spaces/junaidte14/django-admin-dashboard/templates/agents/create.html
-
curl -L -o create.html https://huggingface.co/spaces/junaidte14/django-admin-dashboard/resolve/main/templates/agents/create.html
8.92 kB
| {% extends "base.html" %} | |
| {% block content %} | |
| <div class="max-w-7xl mx-auto p-6"> | |
| <!-- HEADER --> | |
| <div class="mb-8"> | |
| <h1 class="text-3xl font-bold"> | |
| Create AI Agent | |
| </h1> | |
| <p class="text-gray-500 mt-2"> | |
| Start from a template or build your own workflow | |
| </p> | |
| </div> | |
| <!-- TEMPLATE GRID --> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-5 mb-8"> | |
| {% for template in templates %} | |
| <button | |
| type="button" | |
| data-template-id="{{ template.id }}" | |
| onclick="useTemplate(this)" | |
| class="template-card bg-white border rounded-2xl p-5 text-left hover:border-black hover:shadow-lg transition"> | |
| <div class="flex items-center justify-between mb-3"> | |
| <div class="font-semibold text-lg"> | |
| {{ template.name }} | |
| </div> | |
| <div class="text-xs bg-gray-100 px-2 py-1 rounded-full"> | |
| Template | |
| </div> | |
| </div> | |
| <p class="text-sm text-gray-500"> | |
| {{ template.description }} | |
| </p> | |
| <div class="mt-4 text-xs text-gray-400"> | |
| {{ template.template.config.steps|length }} Steps | |
| </div> | |
| </button> | |
| {% endfor %} | |
| <!-- SCRATCH --> | |
| <button | |
| type="button" | |
| onclick="startScratch()" | |
| class="bg-gray-50 border-2 border-dashed rounded-2xl p-5 text-left hover:border-black transition"> | |
| <div class="font-semibold text-lg mb-3"> | |
| Start From Scratch | |
| </div> | |
| <p class="text-sm text-gray-500"> | |
| Build a fully custom conversational workflow | |
| </p> | |
| </button> | |
| </div> | |
| <!-- FORM --> | |
| <form method="POST" | |
| class="bg-white border rounded-2xl p-6 space-y-6"> | |
| {% csrf_token %} | |
| <input | |
| type="hidden" | |
| name="config" | |
| id="config-input"> | |
| <!-- BASIC --> | |
| <div class="grid grid-cols-2 gap-5"> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Agent Name | |
| </label> | |
| <input | |
| name="name" | |
| required | |
| class="w-full border rounded-xl p-3" | |
| placeholder="Support Assistant"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Agent Type | |
| </label> | |
| <select | |
| name="agent_type" | |
| class="w-full border rounded-xl p-3"> | |
| <option value="custom">Custom</option> | |
| <option value="support_ticket">Support Ticket</option> | |
| <option value="order_taking">Order Taking</option> | |
| <option value="appointment_booking">Appointment Booking</option> | |
| <option value="lead_qualification">Lead Qualification</option> | |
| </select> | |
| </div> | |
| </div> | |
| <!-- DESCRIPTION --> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Description | |
| </label> | |
| <textarea | |
| name="description" | |
| rows="3" | |
| class="w-full border rounded-xl p-3" | |
| placeholder="Describe this agent"></textarea> | |
| </div> | |
| <!-- SETTINGS --> | |
| <div class="grid grid-cols-3 gap-5"> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Status | |
| </label> | |
| <select | |
| name="status" | |
| class="w-full border rounded-xl p-3"> | |
| <option value="draft">Draft</option> | |
| <option value="active">Active</option> | |
| <option value="inactive">Inactive</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Max Retries | |
| </label> | |
| <input | |
| type="number" | |
| name="max_retries" | |
| value="3" | |
| class="w-full border rounded-xl p-3"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-2"> | |
| Timeout | |
| </label> | |
| <input | |
| type="number" | |
| name="timeout_minutes" | |
| value="30" | |
| class="w-full border rounded-xl p-3"> | |
| </div> | |
| </div> | |
| <!-- ADVANCED --> | |
| <div class="border-t pt-6"> | |
| <div class="font-semibold mb-4"> | |
| Runtime Messages | |
| </div> | |
| <div class="space-y-4"> | |
| <textarea | |
| name="welcome_message" | |
| rows="2" | |
| class="w-full border rounded-xl p-3" | |
| placeholder="Welcome message">Hello! How can I help you today?</textarea> | |
| <textarea | |
| name="completion_message" | |
| rows="2" | |
| class="w-full border rounded-xl p-3" | |
| placeholder="Completion message">Thank you! Your request has been submitted.</textarea> | |
| <textarea | |
| name="error_message" | |
| rows="2" | |
| class="w-full border rounded-xl p-3" | |
| placeholder="Error message">Sorry, I didn't understand that.</textarea> | |
| </div> | |
| </div> | |
| <!-- FOOTER --> | |
| <div class="flex justify-end gap-3"> | |
| <a href="{% url 'dashboard:agents' %}" | |
| class="px-5 py-3 bg-gray-100 rounded-xl"> | |
| Cancel | |
| </a> | |
| <button | |
| class="px-5 py-3 bg-black text-white rounded-xl"> | |
| Create & Open Builder | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| {{ templates|json_script:"agent-templates" }} | |
| <script> | |
| const ALL_TEMPLATES = JSON.parse( | |
| document.getElementById("agent-templates").textContent | |
| ); | |
| let selectedTemplate = null; | |
| let selectedConfig = { | |
| steps: [], | |
| actions: [], | |
| settings: {}, | |
| extensions: {} | |
| }; | |
| function useTemplate(button) { | |
| try { | |
| const templateId = button.dataset.templateId; | |
| const selected = ALL_TEMPLATES.find( | |
| t => t.id === templateId | |
| ); | |
| if (!selected) { | |
| console.error("Template not found"); | |
| return; | |
| } | |
| const templateData = selected.template; | |
| selectedTemplate = templateData; | |
| selectedConfig = templateData.config || { | |
| steps: [], | |
| actions: [], | |
| settings: {}, | |
| extensions: {} | |
| }; | |
| document.getElementById("config-input").value = JSON.stringify(selectedConfig); | |
| // Autofill form | |
| document.querySelector('[name="name"]').value = | |
| templateData.name || ""; | |
| document.querySelector('[name="agent_type"]').value = | |
| templateData.agent_type || "custom"; | |
| document.querySelector('[name="description"]').value = | |
| templateData.description || ""; | |
| document.querySelector('[name="welcome_message"]').value = | |
| templateData.welcome_message || ""; | |
| document.querySelector('[name="completion_message"]').value = | |
| templateData.completion_message || ""; | |
| document.querySelector('[name="error_message"]').value = | |
| templateData.error_message || ""; | |
| // UI selection | |
| document.querySelectorAll(".template-card") | |
| .forEach(el => { | |
| el.classList.remove("ring-2", "ring-black"); | |
| }); | |
| button.classList.add("ring-2", "ring-black"); | |
| console.log("Loaded template:", templateData); | |
| } catch (err) { | |
| console.error("Template parse failed", err); | |
| } | |
| } | |
| function startScratch() { | |
| selectedTemplate = null; | |
| selectedConfig = { | |
| steps: [], | |
| actions: [], | |
| settings: {}, | |
| extensions: {} | |
| }; | |
| document.getElementById("config-input").value = JSON.stringify(selectedConfig); | |
| document.querySelector('[name="name"]').value = ""; | |
| document.querySelector('[name="description"]').value = ""; | |
| document.querySelectorAll(".template-card") | |
| .forEach(el => { | |
| el.classList.remove("ring-2", "ring-black"); | |
| }); | |
| } | |
| document.querySelector("form").addEventListener("submit", function() { | |
| document.getElementById("config-input").value = JSON.stringify(selectedConfig); | |
| console.log("Submitting config:", selectedConfig); | |
| }); | |
| </script> | |
| {% endblock %} |