File size: 14,796 Bytes
091efc4
 
 
 
0e369cd
28d2c01
 
 
9b654e3
8574870
9b654e3
8574870
dcc108f
 
9b654e3
 
c4bd131
 
 
 
8574870
 
9b654e3
 
82f4b6f
99051d0
8574870
82f4b6f
6c2fc64
 
82f4b6f
6c2fc64
 
 
8574870
dcc108f
 
 
 
 
 
 
 
 
 
8574870
 
 
 
 
82f4b6f
8574870
 
5078dae
 
 
8574870
 
 
 
 
 
 
 
 
 
82f4b6f
 
 
 
8574870
 
5078dae
8574870
5078dae
 
 
 
 
 
 
 
 
 
 
 
6c2fc64
 
8574870
9a5c4c1
 
 
dcc108f
9a5c4c1
 
 
 
 
 
 
dcc108f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1cad839
 
 
6c2fc64
 
 
 
1cad839
 
6c2fc64
1cad839
 
 
 
 
 
 
 
c68d274
b7a0abe
 
 
6c2fc64
 
 
 
b7a0abe
 
82f4b6f
b7a0abe
6c2fc64
82f4b6f
b7a0abe
 
82f4b6f
b7a0abe
6c2fc64
 
82f4b6f
 
 
 
 
b7a0abe
 
6c2fc64
82f4b6f
6c2fc64
b7a0abe
 
 
 
 
9a5c4c1
 
 
 
 
8574870
 
 
 
 
 
 
5078dae
8574870
5078dae
dcc108f
8574870
 
 
 
5078dae
 
dcc108f
8574870
5078dae
 
 
 
 
dcc108f
6c2fc64
 
8574870
 
 
6c2fc64
8574870
 
9a5c4c1
 
dcc108f
9a5c4c1
 
 
 
 
 
dcc108f
9a5c4c1
 
 
 
8574870
 
 
 
 
 
5078dae
8574870
 
5078dae
8574870
 
 
 
 
 
 
5078dae
 
8574870
dcc108f
8574870
 
5078dae
 
 
 
6c2fc64
 
8574870
 
 
82f4b6f
 
 
 
 
8574870
82f4b6f
 
9a5c4c1
82f4b6f
 
 
6c2fc64
82f4b6f
6c2fc64
8574870
9a5c4c1
8574870
 
9a5c4c1
 
 
 
 
8574870
 
 
 
 
 
 
58ab20c
06fa89e
 
 
 
 
 
 
 
 
 
 
dcc108f
06fa89e
 
 
 
 
 
 
 
 
 
 
58ab20c
9a5c4c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58ab20c
 
 
dcc108f
58ab20c
 
 
 
 
dcc108f
58ab20c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99051d0
091efc4
 
 
8574870
82f4b6f
9a5c4c1
b7a0abe
 
 
c68d274
b7a0abe
dcc108f
214af7d
1cad839
a0409b4
 
b406dd8
9356437
 
 
a0409b4
9a5c4c1
 
 
 
 
 
2ed385e
 
5078dae
9a5c4c1
8574870
9b654e3
8574870
214af7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c68d274
214af7d
6a4e7cd
c96790a
214af7d
 
 
 
 
 
99051d0
8574870
58ab20c
8574870
99051d0
9b654e3
214af7d
c68d274
863efcd
 
091efc4
cffbc30
8574870
 
 
 
 
 
 
 
5078dae
 
 
8574870
 
 
 
 
37d5759
091efc4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="google-site-verification" content="mjJiAovmpZmIMQMVjWpYGLVpP13InFuFAFRphXQ2EzQ" />
  <link rel="icon" type="image/x-icon" href="/favicon.ico">
  <link rel="icon" type="image/svg+xml" href="/favicon.svg">
  <link rel="apple-touch-icon" href="/favicon-192.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>DeepShell Chat</title>

  <!-- Optional: Prism for code highlighting inside responses -->
  <link rel="stylesheet" id="prism-theme" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" />
  <link rel="stylesheet" id="prism-light-theme" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" disabled />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-docker.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-hcl.min.js"></script>

  <!-- Optional: marked for Markdown rendering -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js"></script>

  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">
  <style>
    :root {
      --bg: #0a0a0a;
      --panel: #161616;
      --border: #2a2a2a;
      --text: #e0e0e0;
      --muted: #888888;
      --accent: #00a832;
      --accent-2: #0e7a9a;
    }
    :root.light {
      --bg: #f8fafc;
      --panel: #ffffff;
      --border: #e2e8f0;
      --text: #1e293b;
      --muted: #64748b;
      --accent: #16a34a;
      --accent-2: #2563eb;
    }
    * { transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: 'JetBrains Mono', 'Courier New', monospace;
    }
    .container {
      max-width: 1400px;
      margin: 0 auto;
      padding: 24px 40px;
    }
    header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }
    .brand {
      font-weight: 700;
      font-size: 18px;
      letter-spacing: 1px;
      font-family: 'Courier New', monospace;
      color: var(--accent);
      text-shadow: 0 0 10px #00ff4155;
    }
    .status {
      font-size: 13px;
      color: var(--muted);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #ef4444;
      display: inline-block;
    }
    .status-dot.ok {
      background: #00a832;
      box-shadow: none;
    }
    .header-btn {
      padding: 6px 12px;
      font-size: 12px;
      background: var(--panel);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.2s;
    }
    .theme-btn {
      padding: 4px 10px;
      font-size: 13px;
      background: var(--panel);
      color: var(--muted);
      border: 1px solid var(--border);
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.2s;
    }
    .theme-btn:hover {
      background: var(--border);
      color: var(--text);
    }
    .tts-btn {
      padding: 4px 12px;
      font-size: 12px;
      background: #1a1a1a;
      color: #aaaaaa;
      border: 1px solid #333333;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      transition: all 0.2s;
    }
    .tts-btn.tts-active {
      background: #22c55e;
      color: white;
      border-color: #16a34a;
      box-shadow: 0 0 8px #22c55e55;
    }

    .mode-toggle {
      display: flex;
      align-items: center;
      gap: 6px;
      background: transparent;
      border: none;
      padding: 0;
    }
    .mode-btn {
      padding: 5px 14px;
      font-size: 12px;
      border: 1px solid #333333;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      transition: all 0.2s;
      background: #1a1a1a;
      color: #aaaaaa;
      letter-spacing: 0.5px;
    }
    .mode-btn:hover {
      color: var(--accent);
      border-color: var(--accent);
    }
    .mode-btn.active {
      background: #00a832;
      color: #000000;
      box-shadow: none;
    }
    .mode-btn.trainer-active {
      background: #f59e0b;
      color: white;
    }
    .header-btn:hover {
      background: #334155;
      border-color: #475569;
      transform: translateY(-1px);
    }
    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
    }
    #chat-output {
      height: 70vh;
      overflow-y: auto;
      padding: 16px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
    }
    .message {
      margin: 12px 0;
      padding: 14px 18px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      line-height: 1.7;
      font-size: 15px;
    }
    .message.user-msg {
      background: var(--panel);
      border-color: #1e2a3a;
      border-left: 2px solid #1e3a5a;
    }
    .message strong {
      display: inline-block;
      color: #00a832;
      margin-bottom: 6px;
    }
    .message.error {
      border-color: #ef4444;
      background: var(--bg);
    }
    .message.error strong {
      color: #ef4444;
    }
    .message.loading {
      border-color: #f59e0b;
      background: var(--bg);
    }
    .message.loading strong {
      color: #f59e0b;
    }
    pre {
      margin: 6px 0 0;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .composer {
      margin-top: 16px;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 12px;
      align-items: start;
    }
    #chat-input {
      width: 100%;
      resize: vertical;
      min-height: 80px;
      max-height: 240px;
      padding: 14px 16px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg);
      color: var(--text);
      font-family: inherit;
      font-size: 15px;
    }
    #chat-input:focus {
      outline: none;
      border-color: #1e3a4a;
      box-shadow: none;
    }
    #chat-send {
      height: 40px;
      padding: 0 20px;
      border: 1px solid var(--accent);
      background: transparent;
      color: var(--accent);
      border-radius: 4px;
      cursor: pointer;
      font-weight: 700;
      font-family: 'Courier New', monospace;
      transition: all 0.2s;
      letter-spacing: 1px;
    }
    #chat-send:hover:not(:disabled) {
      background: #00a832;
      color: #000000;
      box-shadow: none;
    }
    #chat-send:hover:not(:disabled) {
      border-color: #334155;
    }
    #chat-send:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      background: #1a1a1a;
    }
    .hint {
      margin-top: 8px;
      color: var(--muted);
      font-size: 12px;
    }
    a { color: var(--accent); text-decoration: none; }
    a:hover { text-decoration: underline; }

    /* Copy button styles */
    .code-wrapper {
      position: relative;
      margin: 6px 0 0;
    }
    .copy-btn {
      position: absolute;
      top: 8px;
      right: 8px;
      padding: 4px 10px;
      font-size: 11px;
      background: var(--panel);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 4px;
      cursor: pointer;
      z-index: 10;
      font-weight: 600;
    }
    .copy-btn:hover {
      background: #334155;
      border-color: #475569;
    }

    /* Loading spinner */
    .spinner {
      display: inline-block;
      width: 12px;
      height: 12px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin-left: 8px;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* Command execution styles */
    .command-wrapper {
      margin: 10px 0;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px;
    }
    .command-block {
      background: var(--panel);
      padding: 12px;
      border-radius: 6px;
      margin: 0 0 8px 0;
      font-family: 'Courier New', monospace;
      color: #22c55e;
      border-left: 3px solid #22c55e;
    }
    .command-buttons {
      display: flex;
      gap: 8px;
    }
    .execute-btn {
      padding: 6px 16px;
      font-size: 13px;
      background: linear-gradient(180deg, #22c55e, #16a34a);
      color: white;
      border: 1px solid #16a34a;
      border-radius: 6px;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.2s;
    }
    .execute-btn:hover:not(:disabled) {
      background: linear-gradient(180deg, #16a34a, #15803d);
      transform: translateY(-1px);
    }
    .execute-btn:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }
  </style>
</head>
<body>
  <div class="container">
    <header>
      <div class="brand">&gt;_ DeepShell <span id="mode-label" style="font-size:11px;color:var(--muted);font-weight:400;margin-left:6px;"></span></div>
      <div style="display: flex; align-items: center; gap: 12px;">
        <div class="mode-toggle">
          <button class="mode-btn active" id="btn-assistant" onclick="setMode('assistant')">๐Ÿค– Assistant</button>
          <button class="mode-btn" id="btn-trainer" onclick="setMode('trainer')">๐ŸŽ“ Trainer</button>

        </div>
        <button class="theme-btn" id="theme-btn" onclick="toggleTheme()" title="Toggle light/dark theme">๐ŸŒ™</button>
        <button id="tts-btn" class="tts-btn" onclick="toggleTTS()" title="Voice OFF โ€” click to enable">๐Ÿ”‡ Voice OFF</button>
        <button class="tts-btn" onclick="replayLast()" title="Replay last response">๐Ÿ” Replay</button>
        <select id="lang-select" class="header-btn" onchange="setLang(this.value)" title="TTS Language">
          <option value="en-US">๐Ÿ‡บ๐Ÿ‡ธ EN</option>
          <option value="hi-IN">๐Ÿ‡ฎ๐Ÿ‡ณ HI</option>
          <option value="ta-IN">๐Ÿ‡ฎ๐Ÿ‡ณ TA (soon)</option>
          <option value="te-IN">๐Ÿ‡ฎ๐Ÿ‡ณ TE (soon)</option>
          <option value="ar-SA">๐Ÿ‡ธ๐Ÿ‡ฆ AR (soon)</option>
        </select>
        <button id="export-btn" class="header-btn" title="Export chat as Markdown">
          ๐Ÿ“ฅ Export
        </button>
        <button id="clear-btn" class="header-btn" title="Clear conversation">
          ๐Ÿ—‘๏ธ Clear
        </button>
        <a href="/about.html" class="header-btn" style="text-decoration:none;">About</a>
        <a href="/contact.html" class="header-btn" style="text-decoration:none;">Contact</a>
        <div class="status"><span class="status-dot" id="status-dot"></span>Backend: <span id="status">checkingโ€ฆ</span></div>
      </div>
    </header>

    <div class="panel">
      <div id="chat-output" class="panel">
        <div id="welcome-msg" style="
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          height: 100%;
          text-align: center;
          padding: 40px 20px;
          opacity: 0.85;
        ">
          <div style="font-size: 48px; margin-bottom: 16px;">๐Ÿ–ฅ๏ธ</div>
          <div style="font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 8px;">&gt;_ DeepShell</div>
          <div style="font-size: 13px; color: var(--muted); margin-bottom: 24px; letter-spacing: 1px;">AI-POWERED DEVOPS ASSISTANT & TRAINER</div>
          <div style="display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-bottom: 24px;">
            <div style="background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 20px; min-width: 140px;">
              <div style="font-size: 20px;">๐Ÿค–</div>
              <div style="font-size: 13px; font-weight: 600; color: var(--accent); margin: 4px 0;">Assistant</div>
              <div style="font-size: 11px; color: var(--muted);">Fast DevOps answers</div>
            </div>
            <div style="background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 20px; min-width: 140px;">
              <div style="font-size: 20px;">๐ŸŽ“</div>
              <div style="font-size: 13px; font-weight: 600; color: var(--accent); margin: 4px 0;">Trainer</div>
              <div style="font-size: 11px; color: var(--muted);">Learn with examples</div>
            </div>

          </div>
          <div style="font-size: 11px; color: var(--muted); max-width: 900px; line-height: 1.6; text-align: center; white-space: nowrap;">
            Linux โ€ข Docker โ€ข Kubernetes โ€ข Terraform โ€ข AWS โ€ข Ansible โ€ข Bash
          </div>
          <div style="margin-top: 20px; font-size: 11px; color: var(--muted);">
            ๐Ÿ”Š Voice TTS in English & Hindi &nbsp;|&nbsp; โšก Powered by Groq &nbsp;|&nbsp; ๐Ÿ”’ DevOps-only scope
          </div>
        </div>
      </div>

      <form id="chat-form" class="composer" autocomplete="off">
        <textarea id="chat-input" placeholder="Type your promptโ€ฆ e.g., Show me all running Docker containers."></textarea>
        <button id="chat-send" type="submit">Send</button>
      </form>

      <div class="hint" style="font-size: 13px; text-align:center;">
        ๐Ÿ’ก Tip: All code blocks have copy buttons. &nbsp;|&nbsp; Use <b>Trainer mode</b> for structured learning.
      </div>
    </div>
  </div>

  <script src="./app.js"></script>
  <script>
    // simple readiness check
    (async () => {
      const el = document.getElementById('status');
      try {
        const r = await fetch('/chat/ready');
        const j = await r.json().catch(() => ({}));
        const isOk = r.ok && j.status === 'ok';
        el.textContent = isOk ? 'ok' : 'error';
        document.getElementById('status-dot').classList.toggle('ok', isOk);
      } catch {
        el.textContent = 'offline';
      }
    })();
  </script>
<!-- Cloudflare Web Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "26eff89f7fcd4233adca9be52d913feb"}'></script><!-- End Cloudflare Web Analytics -->
</body>
</html>