<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Captain Blackbeep</title>
<script type="module" src="https://unpkg.com/@splinetool/viewer@1.10.13/build/spline-viewer.js"></script>
<style>
html, body {
margin: 0;
height: 100%;
background-color: black;
}
spline-viewer {
width: 100vw;
height: 100vh;
display: block;
}
#chatbox {
position: absolute;
bottom: 20px;
left: 20px;
background: rgba(0, 0, 0, 0.75);
color: #fff;
padding: 32px;
border-radius: 10px;
font-family: monospace;
z-index: 10;
max-width: 300px;
}
#chatbox input {
width: 100%;
margin-bottom: 8px;
padding: 6px;
border: none;
border-radius: 4px;
}
#chatbox button {
width: 100%;
padding: 6px;
background: darkred;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#replyBox {
margin-top: 10px;
font-size: 0.9em;
}
</style>
</head>
<body>
<!-- ✅ Embed the Spline scene -->
<script type="module" src="https://unpkg.com/@splinetool/viewer@1.10.13/build/spline-viewer.js"></script>
<spline-viewer url="https://prod.spline.YOUR-SCENE-ID/scene.splinecode"></spline-viewer>
<!-- ✅ Floating chatbox -->
<div id="chatbox">
<input type="text" id="userInput" placeholder="Ask the Captain..." />
<button onclick="askPirate()">Speak to Blackbeep</button>
<div id="replyBox"></div>
</div>
<script>
const pipedreamEndpoint = "https://'YOUR-PIPEDREAM-ENDPOINT'.m.pipedream.net";
async function askPirate() {
const input = document.getElementById("userInput").value;
if (!input) return;
const replyBox = document.getElementById("replyBox");
replyBox.innerText = "Captain be thinkin'...";
try {
const res = await fetch(pipedreamEndpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ user_input: input })
});
const data = await res.json();
replyBox.innerText = data.reply || "Arrr, the Captain be speechless!";
} catch (err) {
replyBox.innerText = "Error contactin' the seas...";
console.error(err);
}
}
</script>
</body>
</html>