mirror of
https://github.com/senju1337/senju.git
synced 2025-12-23 23:39:27 +00:00
Merge pull request #14 from senju1337/feat/haiku_prompt
feat: Add site for promt input to generate a Haiku
This commit is contained in:
commit
83add1d0a3
2 changed files with 67 additions and 0 deletions
|
|
@ -37,3 +37,11 @@ def haiku_view(haiku_id):
|
|||
"haiku.html",
|
||||
context=context,
|
||||
title="Haiku of the Day")
|
||||
|
||||
|
||||
@app.route("/prompt")
|
||||
def prompt_view():
|
||||
return render_template(
|
||||
"prompt.html",
|
||||
title="Haiku generation"
|
||||
)
|
||||
|
|
|
|||
59
senju/templates/prompt.html
Normal file
59
senju/templates/prompt.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="flex flex-col items-center justify-center min-h-screen bg-violet-900 text-white p-6">
|
||||
<div class="bg-white text-gray-900 p-8 rounded-xl shadow-lg max-w-lg w-full text-center transform transition duration-300 hover:scale-105">
|
||||
<h1 class="text-3xl font-bold text-violet-700 mb-4">Very 1337 prompt input</h1>
|
||||
<div class="flex flex-col gap-4">
|
||||
<input
|
||||
type="text"
|
||||
id="user-input"
|
||||
placeholder="Type your prompt here..."
|
||||
class="w-full px-4 py-3 text-lg border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-violet-600"
|
||||
/>
|
||||
<button
|
||||
id="submit-btn"
|
||||
class="bg-violet-600 text-white font-bold py-3 px-6 rounded-lg text-lg shadow-md transition duration-300 hover:bg-violet-700 hover:scale-105"
|
||||
>
|
||||
🚀 Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="response-box" class="mt-8 bg-white text-gray-900 p-6 rounded-lg shadow-lg max-w-lg w-full text-center opacity-0 transition-opacity duration-500 ease-in-out">
|
||||
<h2 class="text-2xl font-semibold text-violet-700">Response:</h2>
|
||||
<p id="ai-response" class="text-lg text-gray-700 mt-2 italic">Waiting for input...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById("submit-btn").addEventListener("click", function() {
|
||||
let userInput = document.getElementById("user-input").value;
|
||||
let responseBox = document.getElementById("response-box");
|
||||
let responseText = document.getElementById("ai-response");
|
||||
|
||||
if (userInput.trim() === "") {
|
||||
responseText.textContent = "Please enter a prompt!";
|
||||
}
|
||||
else if (userInput.trim()==="amogus"){
|
||||
responseText.textContent = "🤖 AI is thinking...";
|
||||
responseBox.classList.remove("opacity-0");
|
||||
|
||||
// Simulated AI response delay
|
||||
setTimeout(() => {
|
||||
responseText.textContent = `Sus imposter ඞ`;
|
||||
}, 1500);
|
||||
}
|
||||
else {
|
||||
responseText.textContent = "🤖 AI is thinking...";
|
||||
responseBox.classList.remove("opacity-0");
|
||||
|
||||
// Simulated AI response delay
|
||||
setTimeout(() => {
|
||||
responseText.textContent = `"${userInput}" sounds interesting! Let's explore more! 🌟`;
|
||||
}, 1500);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue