Codexcoder commited on
Commit
b7bfbab
·
verified ·
1 Parent(s): 04820f5

integration: add site/chat.html

Browse files
Files changed (1) hide show
  1. site/chat.html +155 -0
site/chat.html ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>DeepSeek V4 Chat — Sovereign | Conversational Core</title>
7
+ <meta name="description" content="DeepSeek V4 chat — the sovereign-tuned conversational core of the Sovereign stack. Sessions, sovereign context, local echo fallback.">
8
+ <meta name="keywords" content="deepseek v4, chat, sovereign, conversational ai, sovereign-tuned">
9
+ <link rel="canonical" href="https://onegayunicorn.github.io/deepseek-v4-sovereign/chat.html">
10
+ <meta property="og:title" content="DeepSeek V4 Chat — Sovereign">
11
+ <meta property="og:description" content="Sovereign-tuned conversational core — session chat with sovereign context and local echo fallback.">
12
+ <meta property="og:type" content="website">
13
+ <style>
14
+ :root{
15
+ --bg:#0b1020; --bg2:#0e1830; --panel:#121a36; --panel2:#182248;
16
+ --line:#1e2a4e; --text:#e8ecf8; --muted:#9aa6c8; --dim:#6b76a0;
17
+ --teal:#0fa3a3; --gold:#f2b45c; --violet:#a78bfa; --coral:#f26d7a;
18
+ --user:#1a3a4a; --assistant:#141c38;
19
+ }
20
+ *{margin:0;padding:0;box-sizing:border-box}
21
+ 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}
22
+ a{color:var(--teal);text-decoration:none}
23
+ 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)}
24
+ header .logo{font-weight:600}
25
+ header .logo span{color:var(--teal)}
26
+ header nav{display:flex;gap:16px;margin-left:auto}
27
+ header nav a{color:var(--muted);font-size:13.5px}
28
+ header nav a:hover{color:var(--text)}
29
+ .badge{font-size:11px;padding:4px 10px;border-radius:99px;border:1px solid var(--gold);color:var(--gold)}
30
+ .badge.api{border-color:var(--teal);color:var(--teal)}
31
+ .badge.local{border-color:var(--gold);color:var(--gold)}
32
+ .badge.off{border-color:var(--coral);color:var(--coral)}
33
+ main{flex:1;display:flex;flex-direction:column;max-width:860px;width:100%;margin:0 auto;padding:18px 22px;overflow:hidden}
34
+ #log{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:12px;padding:6px 2px 14px}
35
+ .msg{max-width:78%;padding:12px 16px;border-radius:16px;font-size:14.5px;white-space:pre-wrap;word-wrap:break-word}
36
+ .msg.user{align-self:flex-end;background:var(--user);border:1px solid rgba(15,163,163,.35);border-bottom-right-radius:4px}
37
+ .msg.assistant{align-self:flex-start;background:var(--assistant);border:1px solid var(--line);border-bottom-left-radius:4px}
38
+ .msg .meta{display:block;font-size:11px;color:var(--dim);margin-top:6px}
39
+ .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%}
40
+ .chips{display:flex;gap:8px;flex-wrap:wrap;padding:0 2px 8px}
41
+ .chip{font-size:12.5px;padding:6px 12px;border-radius:99px;border:1px solid var(--line);color:var(--muted);cursor:pointer;background:var(--panel)}
42
+ .chip:hover{border-color:var(--teal);color:var(--teal)}
43
+ .inputbar{display:flex;gap:10px;padding-top:10px;border-top:1px solid var(--line)}
44
+ 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}
45
+ textarea:focus{outline:none;border-color:var(--teal)}
46
+ button{background:var(--teal);color:#031018;border:none;border-radius:12px;padding:0 22px;font:inherit;font-weight:600;cursor:pointer;font-size:14px}
47
+ button:hover{filter:brightness(1.12)}
48
+ button:disabled{opacity:.45;cursor:not-allowed}
49
+ #notice{font-size:12px;color:var(--dim);text-align:center;padding:8px 0 0}
50
+ #notice code{background:var(--panel2);padding:1px 6px;border-radius:5px;font-size:11.5px}
51
+ </style>
52
+ </head>
53
+ <body>
54
+ <header>
55
+ <div class="logo">DeepSeek V4 <span>Chat</span></div>
56
+ <span class="badge" id="modeBadge">connecting…</span>
57
+ <nav>
58
+ <a href="index.html">Sovereign</a>
59
+ <a href="pec5d.html">PEC5D</a>
60
+ <a href="kyrexis.html">KyrexisAI</a>
61
+ </nav>
62
+ </header>
63
+ <main>
64
+ <div id="log">
65
+ <div class="msg system">Welcome to the DeepSeek-V4-Sovereign conversational core.
66
+ Ask about the ecosystem: PEC5D cores, KyrexisAI, the cold-case grid, IPT, or coral line.</div>
67
+ </div>
68
+ <div class="chips" id="chips">
69
+ <button class="chip" data-q="What modules are available in the Sovereign stack?">Modules overview</button>
70
+ <button class="chip" data-q="Explain the Pattern Bridge pipeline.">Pattern Bridge</button>
71
+ <button class="chip" data-q="What is Invisible Pressure Theory?">Invisible Pressure</button>
72
+ <button class="chip" data-q="Tell me about the CORAL-SPREADER drone.">Coral drone</button>
73
+ </div>
74
+ <div class="inputbar">
75
+ <textarea id="input" placeholder="Message the sovereign core…" rows="1"></textarea>
76
+ <button id="send">Send</button>
77
+ </div>
78
+ <div id="notice">mode: <code>local echo</code> · API at <code>/api/v1/chat</code> · model <code>sovereign/deepseek-v4-sovereign</code></div>
79
+ </main>
80
+ <script>
81
+ (function () {
82
+ var logEl = document.getElementById('log');
83
+ var inputEl = document.getElementById('input');
84
+ var sendBtn = document.getElementById('send');
85
+ var modeBadge = document.getElementById('modeBadge');
86
+ var sessionId = '';
87
+ var mode = 'local';
88
+
89
+ function api(path, body) {
90
+ return fetch('/api/v1/chat' + path, {
91
+ method: 'POST',
92
+ headers: { 'Content-Type': 'application/json' },
93
+ body: body ? JSON.stringify(body) : undefined
94
+ }).then(function (r) { return r.json(); });
95
+ }
96
+
97
+ function addMsg(role, text) {
98
+ var d = document.createElement('div');
99
+ d.className = 'msg ' + role;
100
+ d.textContent = text;
101
+ logEl.appendChild(d);
102
+ logEl.scrollTop = logEl.scrollHeight;
103
+ }
104
+
105
+ function boot() {
106
+ Promise.all([
107
+ api('/sessions', {}),
108
+ api('/status', {})
109
+ ]).then(function (res) {
110
+ sessionId = res[0].session_id || '';
111
+ mode = (res[1] && res[1].mode) || 'local';
112
+ modeBadge.textContent = 'mode: ' + mode;
113
+ modeBadge.className = 'badge ' + (mode === 'api' ? 'api' : 'local');
114
+ if (mode === 'local') {
115
+ addMsg('system', 'No DEEPSEEK_API_KEY configured — running in local echo mode. ' +
116
+ 'Set the key on the server to enable the DeepSeek V4 API.');
117
+ }
118
+ }).catch(function () {
119
+ mode = 'off';
120
+ modeBadge.textContent = 'API offline';
121
+ modeBadge.className = 'badge off';
122
+ addMsg('system', 'Chat API unreachable. Start the orchestrator (uvicorn sovereign.main:app) ' +
123
+ 'to enable live chat; this page then talks to /api/v1/chat.');
124
+ });
125
+ }
126
+
127
+ function send() {
128
+ var text = inputEl.value.trim();
129
+ if (!text) return;
130
+ addMsg('user', text);
131
+ inputEl.value = '';
132
+ sendBtn.disabled = true;
133
+ api('/send', { message: text, session_id: sessionId })
134
+ .then(function (res) {
135
+ sessionId = res.session_id || sessionId;
136
+ if (res.reply) addMsg('assistant', res.reply);
137
+ else addMsg('system', 'Error: ' + JSON.stringify(res));
138
+ })
139
+ .catch(function () { addMsg('system', 'Network error — is the API server running?'); })
140
+ .finally(function () { sendBtn.disabled = false; });
141
+ }
142
+
143
+ sendBtn.addEventListener('click', send);
144
+ inputEl.addEventListener('keydown', function (e) {
145
+ if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send(); }
146
+ });
147
+ document.querySelectorAll('.chip').forEach(function (c) {
148
+ c.addEventListener('click', function () { inputEl.value = c.dataset.q; send(); });
149
+ });
150
+
151
+ boot();
152
+ })();
153
+ </script>
154
+ </body>
155
+ </html>