Codexcoder's picture
integration: add site/chat.html
b7bfbab verified
Raw History Blame Contribute Delete
7.69 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DeepSeek V4 Chat — Sovereign | Conversational Core</title>
<meta name="description" content="DeepSeek V4 chat — the sovereign-tuned conversational core of the Sovereign stack. Sessions, sovereign context, local echo fallback.">
<meta name="keywords" content="deepseek v4, chat, sovereign, conversational ai, sovereign-tuned">
<link rel="canonical" href="https://onegayunicorn.github.io/deepseek-v4-sovereign/chat.html">
<meta property="og:title" content="DeepSeek V4 Chat — Sovereign">
<meta property="og:description" content="Sovereign-tuned conversational core — session chat with sovereign context and local echo fallback.">
<meta property="og:type" content="website">
<style>
:root{
--bg:#0b1020; --bg2:#0e1830; --panel:#121a36; --panel2:#182248;
--line:#1e2a4e; --text:#e8ecf8; --muted:#9aa6c8; --dim:#6b76a0;
--teal:#0fa3a3; --gold:#f2b45c; --violet:#a78bfa; --coral:#f26d7a;
--user:#1a3a4a; --assistant:#141c38;
}
*{margin:0;padding:0;box-sizing:border-box}
body{background:var(--bg);color:var(--text);font-family:"Inter","SF Pro Text",system-ui,-apple-system,Segoe UI,Roboto,sans-serif;line-height:1.55;height:100vh;display:flex;flex-direction:column}
a{color:var(--teal);text-decoration:none}
header{display:flex;align-items:center;gap:16px;padding:14px 22px;border-bottom:1px solid var(--line);background:rgba(11,16,32,.85);backdrop-filter:blur(10px)}
header .logo{font-weight:600}
header .logo span{color:var(--teal)}
header nav{display:flex;gap:16px;margin-left:auto}
header nav a{color:var(--muted);font-size:13.5px}
header nav a:hover{color:var(--text)}
.badge{font-size:11px;padding:4px 10px;border-radius:99px;border:1px solid var(--gold);color:var(--gold)}
.badge.api{border-color:var(--teal);color:var(--teal)}
.badge.local{border-color:var(--gold);color:var(--gold)}
.badge.off{border-color:var(--coral);color:var(--coral)}
main{flex:1;display:flex;flex-direction:column;max-width:860px;width:100%;margin:0 auto;padding:18px 22px;overflow:hidden}
#log{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:12px;padding:6px 2px 14px}
.msg{max-width:78%;padding:12px 16px;border-radius:16px;font-size:14.5px;white-space:pre-wrap;word-wrap:break-word}
.msg.user{align-self:flex-end;background:var(--user);border:1px solid rgba(15,163,163,.35);border-bottom-right-radius:4px}
.msg.assistant{align-self:flex-start;background:var(--assistant);border:1px solid var(--line);border-bottom-left-radius:4px}
.msg .meta{display:block;font-size:11px;color:var(--dim);margin-top:6px}
.msg.system{align-self:center;background:var(--panel2);border:1px dashed var(--line);color:var(--muted);font-size:12.5px;text-align:center;max-width:90%}
.chips{display:flex;gap:8px;flex-wrap:wrap;padding:0 2px 8px}
.chip{font-size:12.5px;padding:6px 12px;border-radius:99px;border:1px solid var(--line);color:var(--muted);cursor:pointer;background:var(--panel)}
.chip:hover{border-color:var(--teal);color:var(--teal)}
.inputbar{display:flex;gap:10px;padding-top:10px;border-top:1px solid var(--line)}
textarea{flex:1;resize:none;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:12px;padding:12px 14px;font:inherit;font-size:14px;min-height:52px;max-height:140px}
textarea:focus{outline:none;border-color:var(--teal)}
button{background:var(--teal);color:#031018;border:none;border-radius:12px;padding:0 22px;font:inherit;font-weight:600;cursor:pointer;font-size:14px}
button:hover{filter:brightness(1.12)}
button:disabled{opacity:.45;cursor:not-allowed}
#notice{font-size:12px;color:var(--dim);text-align:center;padding:8px 0 0}
#notice code{background:var(--panel2);padding:1px 6px;border-radius:5px;font-size:11.5px}
</style>
</head>
<body>
<header>
<div class="logo">DeepSeek V4 <span>Chat</span></div>
<span class="badge" id="modeBadge">connecting…</span>
<nav>
<a href="index.html">Sovereign</a>
<a href="pec5d.html">PEC5D</a>
<a href="kyrexis.html">KyrexisAI</a>
</nav>
</header>
<main>
<div id="log">
<div class="msg system">Welcome to the DeepSeek-V4-Sovereign conversational core.
Ask about the ecosystem: PEC5D cores, KyrexisAI, the cold-case grid, IPT, or coral line.</div>
</div>
<div class="chips" id="chips">
<button class="chip" data-q="What modules are available in the Sovereign stack?">Modules overview</button>
<button class="chip" data-q="Explain the Pattern Bridge pipeline.">Pattern Bridge</button>
<button class="chip" data-q="What is Invisible Pressure Theory?">Invisible Pressure</button>
<button class="chip" data-q="Tell me about the CORAL-SPREADER drone.">Coral drone</button>
</div>
<div class="inputbar">
<textarea id="input" placeholder="Message the sovereign core…" rows="1"></textarea>
<button id="send">Send</button>
</div>
<div id="notice">mode: <code>local echo</code> · API at <code>/api/v1/chat</code> · model <code>sovereign/deepseek-v4-sovereign</code></div>
</main>
<script>
(function () {
var logEl = document.getElementById('log');
var inputEl = document.getElementById('input');
var sendBtn = document.getElementById('send');
var modeBadge = document.getElementById('modeBadge');
var sessionId = '';
var mode = 'local';
function api(path, body) {
return fetch('/api/v1/chat' + path, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: body ? JSON.stringify(body) : undefined
}).then(function (r) { return r.json(); });
}
function addMsg(role, text) {
var d = document.createElement('div');
d.className = 'msg ' + role;
d.textContent = text;
logEl.appendChild(d);
logEl.scrollTop = logEl.scrollHeight;
}
function boot() {
Promise.all([
api('/sessions', {}),
api('/status', {})
]).then(function (res) {
sessionId = res[0].session_id || '';
mode = (res[1] && res[1].mode) || 'local';
modeBadge.textContent = 'mode: ' + mode;
modeBadge.className = 'badge ' + (mode === 'api' ? 'api' : 'local');
if (mode === 'local') {
addMsg('system', 'No DEEPSEEK_API_KEY configured — running in local echo mode. ' +
'Set the key on the server to enable the DeepSeek V4 API.');
}
}).catch(function () {
mode = 'off';
modeBadge.textContent = 'API offline';
modeBadge.className = 'badge off';
addMsg('system', 'Chat API unreachable. Start the orchestrator (uvicorn sovereign.main:app) ' +
'to enable live chat; this page then talks to /api/v1/chat.');
});
}
function send() {
var text = inputEl.value.trim();
if (!text) return;
addMsg('user', text);
inputEl.value = '';
sendBtn.disabled = true;
api('/send', { message: text, session_id: sessionId })
.then(function (res) {
sessionId = res.session_id || sessionId;
if (res.reply) addMsg('assistant', res.reply);
else addMsg('system', 'Error: ' + JSON.stringify(res));
})
.catch(function () { addMsg('system', 'Network error — is the API server running?'); })
.finally(function () { sendBtn.disabled = false; });
}
sendBtn.addEventListener('click', send);
inputEl.addEventListener('keydown', function (e) {
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send(); }
});
document.querySelectorAll('.chip').forEach(function (c) {
c.addEventListener('click', function () { inputEl.value = c.dataset.q; send(); });
});
boot();
})();
</script>
</body>
</html>