Spaces:
Running
Running
Add branded Devseis chat frontend
Browse files- README.md +5 -4
- devseis-logo.png +0 -0
- index.html +124 -17
README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
---
|
| 2 |
title: Devseis Chat
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
| 1 |
---
|
| 2 |
title: Devseis Chat
|
| 3 |
+
emoji: 💬
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
license: apache-2.0
|
| 9 |
---
|
| 10 |
|
| 11 |
+
Free public chat powered by Qwen2.5-3B-Instruct, served through a Cloudflare Worker proxy.
|
devseis-logo.png
ADDED
|
index.html
CHANGED
|
@@ -1,19 +1,126 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Devseis Chat</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root{
|
| 9 |
+
--bg:#0b0e14; --panel:#11151d; --border:#232a37; --text:#e8ecf4; --muted:#8b94a7;
|
| 10 |
+
--accent:#2f6bff; --accent-text:#ffffff; --bubble-user:#1c2636; --bubble-bot:#161c27;
|
| 11 |
+
}
|
| 12 |
+
@media (prefers-color-scheme: light){
|
| 13 |
+
:root{ --bg:#f4f6fb; --panel:#ffffff; --border:#e2e6ee; --text:#171a21; --muted:#666f80;
|
| 14 |
+
--accent:#2f6bff; --accent-text:#ffffff; --bubble-user:#eaf0ff; --bubble-bot:#f1f2f5; }
|
| 15 |
+
}
|
| 16 |
+
*{box-sizing:border-box;}
|
| 17 |
+
body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;height:100vh;display:flex;flex-direction:column;}
|
| 18 |
+
header{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--border);background:var(--panel);}
|
| 19 |
+
header img{height:32px;width:auto;}
|
| 20 |
+
header .title{font-weight:600;font-size:15px;}
|
| 21 |
+
header .sub{font-size:12px;color:var(--muted);}
|
| 22 |
+
main{flex:1;overflow-y:auto;padding:20px;max-width:820px;width:100%;margin:0 auto;}
|
| 23 |
+
.msg{display:flex;margin-bottom:14px;}
|
| 24 |
+
.msg.user{justify-content:flex-end;}
|
| 25 |
+
.bubble{max-width:75%;padding:10px 14px;border-radius:14px;line-height:1.45;font-size:14.5px;white-space:pre-wrap;}
|
| 26 |
+
.msg.user .bubble{background:var(--bubble-user);border-bottom-right-radius:4px;}
|
| 27 |
+
.msg.bot .bubble{background:var(--bubble-bot);border-bottom-left-radius:4px;}
|
| 28 |
+
.msg.bot.loading .bubble{color:var(--muted);}
|
| 29 |
+
form{display:flex;gap:10px;padding:16px 20px;border-top:1px solid var(--border);background:var(--panel);max-width:820px;width:100%;margin:0 auto;}
|
| 30 |
+
textarea{flex:1;resize:none;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:10px;padding:10px 12px;font-size:14.5px;font-family:inherit;max-height:140px;}
|
| 31 |
+
button{background:var(--accent);color:var(--accent-text);border:none;border-radius:10px;padding:0 18px;font-size:14px;font-weight:600;cursor:pointer;}
|
| 32 |
+
button:disabled{opacity:.5;cursor:not-allowed;}
|
| 33 |
+
footer{text-align:center;font-size:11px;color:var(--muted);padding:8px 0 14px;}
|
| 34 |
+
a{color:var(--accent);}
|
| 35 |
+
</style>
|
| 36 |
+
</head>
|
| 37 |
+
<body>
|
| 38 |
+
<header>
|
| 39 |
+
<img src="devseis-logo.png" alt="Devseis" />
|
| 40 |
+
<div>
|
| 41 |
+
<div class="title">Devseis Chat</div>
|
| 42 |
+
<div class="sub">Free public AI chat · Qwen2.5-3B</div>
|
| 43 |
+
</div>
|
| 44 |
+
</header>
|
| 45 |
+
<main id="thread"></main>
|
| 46 |
+
<form id="form">
|
| 47 |
+
<textarea id="input" rows="1" placeholder="Type a message..." autofocus></textarea>
|
| 48 |
+
<button type="submit" id="send">Send</button>
|
| 49 |
+
</form>
|
| 50 |
+
<footer>Powered by an open 3B model · Made by <a href="https://www.devseis.com" target="_blank" rel="noopener">Devseis</a></footer>
|
| 51 |
+
|
| 52 |
+
<script>
|
| 53 |
+
const WORKER_URL = "WORKER_URL_PLACEHOLDER"; // set to your deployed Cloudflare Worker URL
|
| 54 |
+
|
| 55 |
+
const thread = document.getElementById('thread');
|
| 56 |
+
const form = document.getElementById('form');
|
| 57 |
+
const input = document.getElementById('input');
|
| 58 |
+
const sendBtn = document.getElementById('send');
|
| 59 |
+
|
| 60 |
+
let history = [
|
| 61 |
+
{ role: "system", content: "You are Devseis Chat, a friendly, helpful assistant." }
|
| 62 |
+
];
|
| 63 |
+
|
| 64 |
+
function addMessage(role, text, opts={}) {
|
| 65 |
+
const row = document.createElement('div');
|
| 66 |
+
row.className = 'msg ' + (role === 'user' ? 'user' : 'bot') + (opts.loading ? ' loading' : '');
|
| 67 |
+
const bubble = document.createElement('div');
|
| 68 |
+
bubble.className = 'bubble';
|
| 69 |
+
bubble.textContent = text;
|
| 70 |
+
row.appendChild(bubble);
|
| 71 |
+
thread.appendChild(row);
|
| 72 |
+
thread.scrollTop = thread.scrollHeight;
|
| 73 |
+
return bubble;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
input.addEventListener('input', () => {
|
| 77 |
+
input.style.height = 'auto';
|
| 78 |
+
input.style.height = Math.min(input.scrollHeight, 140) + 'px';
|
| 79 |
+
});
|
| 80 |
+
|
| 81 |
+
input.addEventListener('keydown', (e) => {
|
| 82 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
| 83 |
+
e.preventDefault();
|
| 84 |
+
form.requestSubmit();
|
| 85 |
+
}
|
| 86 |
+
});
|
| 87 |
+
|
| 88 |
+
form.addEventListener('submit', async (e) => {
|
| 89 |
+
e.preventDefault();
|
| 90 |
+
const text = input.value.trim();
|
| 91 |
+
if (!text) return;
|
| 92 |
+
input.value = '';
|
| 93 |
+
input.style.height = 'auto';
|
| 94 |
+
sendBtn.disabled = true;
|
| 95 |
+
|
| 96 |
+
addMessage('user', text);
|
| 97 |
+
history.push({ role: 'user', content: text });
|
| 98 |
+
|
| 99 |
+
const loadingBubble = addMessage('bot', 'Thinking…', { loading: true });
|
| 100 |
+
|
| 101 |
+
try {
|
| 102 |
+
const res = await fetch(WORKER_URL, {
|
| 103 |
+
method: 'POST',
|
| 104 |
+
headers: { 'Content-Type': 'application/json' },
|
| 105 |
+
body: JSON.stringify({ messages: history })
|
| 106 |
+
});
|
| 107 |
+
if (!res.ok) throw new Error('Request failed: ' + res.status);
|
| 108 |
+
const data = await res.json();
|
| 109 |
+
const reply = data.reply || '(no response)';
|
| 110 |
+
loadingBubble.parentElement.classList.remove('loading');
|
| 111 |
+
loadingBubble.textContent = reply;
|
| 112 |
+
history.push({ role: 'assistant', content: reply });
|
| 113 |
+
} catch (err) {
|
| 114 |
+
loadingBubble.parentElement.classList.remove('loading');
|
| 115 |
+
loadingBubble.textContent = 'Sorry, something went wrong. Please try again in a moment.';
|
| 116 |
+
console.error(err);
|
| 117 |
+
} finally {
|
| 118 |
+
sendBtn.disabled = false;
|
| 119 |
+
input.focus();
|
| 120 |
+
}
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
addMessage('bot', "Moien! I'm Devseis Chat. Ask me anything.");
|
| 124 |
+
</script>
|
| 125 |
+
</body>
|
| 126 |
</html>
|