chatkit / index.html
taupirho's picture
Update index.html
6e38ac4 verified
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My static Space</title>
<link rel="stylesheet" href="style.css" />
<!-- Chatbot Embed -->
<style>
.chat-fab {
position: fixed;
right: 20px;
bottom: 20px;
width: 56px;
height: 56px;
border-radius: 50%;
border: none;
cursor: pointer;
background: #111;
color: #fff;
font-size: 24px;
box-shadow: 0 6px 15px rgba(0,0,0,0.25);
z-index: 10000;
}
.chat-panel {
position: fixed;
right: 20px;
bottom: 90px;
width: 400px;
height: 600px;
max-width: calc(100% - 40px);
transform: translateY(20px);
opacity: 0;
pointer-events: none;
transition: opacity .2s ease, transform .2s ease;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 12px 30px rgba(0,0,0,.25);
background: #fff;
z-index: 10000;
}
.chat-panel.open {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
.chat-header {
height: 44px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
background: #111;
color: #fff;
font: 14px/1.2 system-ui, sans-serif;
}
.chat-iframe {
border: 0;
width: 100%;
height: calc(100% - 44px);
display: block;
}
.chat-close {
background: none;
border: 0;
color: #fff;
font-size: 18px;
cursor: pointer;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
const fab = document.createElement('button');
fab.className = 'chat-fab';
fab.textContent = '💬';
fab.setAttribute('aria-label', 'Open chat');
const panel = document.createElement('div');
panel.className = 'chat-panel';
panel.setAttribute('aria-hidden', 'true');
const header = document.createElement('div');
header.className = 'chat-header';
header.innerHTML = `<span>Chatbot</span>`;
const closeBtn = document.createElement('button');
closeBtn.className = 'chat-close';
closeBtn.textContent = '✕';
closeBtn.setAttribute('aria-label', 'Close chat');
closeBtn.addEventListener('click', () => {
panel.classList.remove('open');
panel.setAttribute('aria-hidden', 'true');
});
const iframe = document.createElement('iframe');
iframe.className = 'chat-iframe';
iframe.src = 'https://openai-chatkit-starter-app-mocha.vercel.app';
iframe.allow = 'clipboard-write; microphone; camera';
iframe.referrerPolicy = 'strict-origin-when-cross-origin';
header.appendChild(closeBtn);
panel.appendChild(header);
panel.appendChild(iframe);
document.body.appendChild(fab);
document.body.appendChild(panel);
fab.addEventListener('click', () => {
panel.classList.add('open');
panel.setAttribute('aria-hidden', 'false');
});
});
</script>
<!-- End Chatbot Embed -->
</head>
<body>
<div class="card">
<h1>Welcome to your static Space!</h1>
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
<p>
To start an OpenAI Agent Builder Chat, click the speech bubble icon on the bottom right of the page.
Type in a subject, and the model will give you an interesting fact on it, then tell you a "dad joke" about it
</p>
</div>
</body>
</html>