akhaliq HF Staff commited on
Commit
9277efd
·
1 Parent(s): fa1dfe4

feat: redesign chat interface with a dark theme and modernized message layout

Browse files
Files changed (1) hide show
  1. index.html +173 -125
index.html CHANGED
@@ -16,16 +16,14 @@
16
  </script>
17
  <style>
18
  :root {
19
- --bg-color: #0b0f19;
20
- --chat-bg: #151a2a;
21
- --user-msg: #3b82f6;
22
- --bot-msg: #1e293b;
23
- --text-color: #e2e8f0;
24
- --text-muted: #94a3b8;
25
- --border-color: #334155;
26
- --input-bg: #0f172a;
27
- --glow: 0 0 20px rgba(59, 130, 246, 0.15);
28
- --gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
29
  }
30
 
31
  * {
@@ -35,52 +33,65 @@
35
  }
36
 
37
  body {
38
- font-family: 'Inter', sans-serif;
39
  background-color: var(--bg-color);
40
  color: var(--text-color);
41
  display: flex;
42
  justify-content: center;
43
  height: 100vh;
44
  overflow: hidden;
 
45
  }
46
 
47
  #app {
48
  width: 100%;
49
- max-width: 1000px;
50
  display: flex;
51
  flex-direction: column;
52
  height: 100vh;
53
  position: relative;
54
  }
55
 
56
- /* Glassmorphism Header */
57
  header {
58
- padding: 20px 30px;
59
- background: rgba(15, 23, 42, 0.7);
60
- backdrop-filter: blur(12px);
61
- border-bottom: 1px solid var(--border-color);
62
  display: flex;
63
  align-items: center;
 
 
 
64
  z-index: 10;
65
  }
66
 
67
  .title {
68
- font-size: 1.25rem;
69
  font-weight: 600;
70
- background: var(--gradient);
71
- -webkit-background-clip: text;
72
- -webkit-text-fill-color: transparent;
73
- letter-spacing: -0.02em;
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  /* Chat Container */
77
  #chat-container {
78
  flex: 1;
79
  overflow-y: auto;
80
- padding: 30px;
 
81
  display: flex;
82
  flex-direction: column;
83
- gap: 24px;
84
  scroll-behavior: smooth;
85
  }
86
 
@@ -92,101 +103,112 @@
92
  background: transparent;
93
  }
94
  #chat-container::-webkit-scrollbar-thumb {
95
- background: var(--border-color);
96
  border-radius: 4px;
97
  }
98
 
99
  /* Messages */
 
 
 
 
 
100
  .message {
 
 
101
  display: flex;
102
- flex-direction: column;
103
- max-width: 85%;
104
- animation: fadeIn 0.3s ease-out forwards;
105
  }
106
 
107
- @keyframes fadeIn {
108
- from { opacity: 0; transform: translateY(10px); }
109
- to { opacity: 1; transform: translateY(0); }
 
 
 
 
 
 
 
110
  }
111
 
112
- .message.user {
113
- align-self: flex-end;
 
114
  }
115
 
116
- .message.bot {
117
- align-self: flex-start;
 
 
 
 
 
 
 
118
  }
119
 
120
  .message-content {
121
- padding: 16px 20px;
122
- border-radius: 20px;
123
- font-size: 0.95rem;
124
  line-height: 1.6;
125
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
126
- }
127
-
128
- .message.user .message-content {
129
- background: var(--user-msg);
130
- color: white;
131
- border-bottom-right-radius: 4px;
132
- }
133
-
134
- .message.bot .message-content {
135
- background: var(--bot-msg);
136
- border: 1px solid var(--border-color);
137
- border-bottom-left-radius: 4px;
138
- overflow-x: auto;
139
  }
140
 
141
  /* Markdown Styles in Bot Message */
142
- .message.bot .message-content p {
143
- margin-bottom: 0.75em;
144
  }
145
- .message.bot .message-content p:last-child {
146
  margin-bottom: 0;
147
  }
148
- .message.bot .message-content pre {
149
- background: #0f172a;
150
- padding: 12px;
151
  border-radius: 8px;
152
  overflow-x: auto;
153
- margin: 10px 0;
154
  border: 1px solid var(--border-color);
155
  }
156
- .message.bot .message-content code {
157
  font-family: 'JetBrains Mono', monospace;
158
- font-size: 0.85em;
159
- background: rgba(0, 0, 0, 0.2);
160
  padding: 2px 4px;
161
  border-radius: 4px;
162
  }
163
- .message.bot .message-content pre code {
164
  background: transparent;
165
  padding: 0;
 
166
  }
167
 
168
  /* Input Area */
169
  #input-container {
170
- padding: 24px 30px;
171
- background: var(--chat-bg);
172
- border-top: 1px solid var(--border-color);
173
- box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
174
- position: relative;
 
 
175
  }
176
 
177
  .input-wrapper {
178
  display: flex;
179
  align-items: flex-end;
180
  background: var(--input-bg);
181
- border: 1px solid var(--border-color);
182
  border-radius: 24px;
183
- padding: 8px 16px;
184
- transition: border-color 0.2s, box-shadow 0.2s;
 
 
 
185
  }
186
 
187
  .input-wrapper:focus-within {
188
- border-color: #3b82f6;
189
- box-shadow: var(--glow);
190
  }
191
 
192
  #user-input {
@@ -197,8 +219,8 @@
197
  font-size: 1rem;
198
  font-family: 'Inter', sans-serif;
199
  resize: none;
200
- padding: 10px 0;
201
- max-height: 150px;
202
  min-height: 24px;
203
  outline: none;
204
  line-height: 1.5;
@@ -209,52 +231,45 @@
209
  }
210
 
211
  #send-btn {
212
- background: var(--gradient);
 
 
 
 
213
  border: none;
214
- width: 40px;
215
- height: 40px;
216
  border-radius: 50%;
217
  display: flex;
218
  align-items: center;
219
  justify-content: center;
220
  cursor: pointer;
221
- margin-bottom: 4px;
222
- margin-left: 12px;
223
- transition: transform 0.2s, box-shadow 0.2s;
224
- color: white;
225
- flex-shrink: 0;
226
  }
227
 
228
  #send-btn:hover {
229
- transform: scale(1.05);
230
- box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
231
  }
232
 
233
  #send-btn:disabled {
234
- opacity: 0.5;
 
235
  cursor: not-allowed;
236
- transform: none;
237
- box-shadow: none;
238
  }
239
 
240
  #send-btn svg {
241
- width: 18px;
242
- height: 18px;
243
  fill: currentColor;
244
- margin-left: 2px;
245
  }
246
 
247
  /* Loading Indicator */
248
  .typing-indicator {
249
- display: none;
250
  align-items: center;
251
  gap: 4px;
252
- padding: 12px 16px;
253
- background: var(--bot-msg);
254
- border-radius: 16px;
255
- border-bottom-left-radius: 4px;
256
  width: fit-content;
257
- border: 1px solid var(--border-color);
258
  }
259
 
260
  .dot {
@@ -269,8 +284,8 @@
269
  .dot:nth-child(2) { animation-delay: -0.16s; }
270
 
271
  @keyframes bounce {
272
- 0%, 80%, 100% { transform: scale(0); }
273
- 40% { transform: scale(1); }
274
  }
275
 
276
  .empty-state {
@@ -281,17 +296,31 @@
281
  height: 100%;
282
  color: var(--text-muted);
283
  text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
 
285
  .empty-state h2 {
286
- font-size: 2rem;
287
- margin-bottom: 12px;
288
- background: var(--gradient);
289
- -webkit-background-clip: text;
290
- -webkit-text-fill-color: transparent;
291
- }
292
- .empty-state p {
293
- max-width: 400px;
294
- line-height: 1.6;
295
  }
296
  </style>
297
  </head>
@@ -299,32 +328,38 @@
299
 
300
  <div id="app">
301
  <header>
302
- <div class="title">DeepSeek-V4-Pro</div>
303
  </header>
304
 
305
  <div id="chat-container">
306
  <div class="empty-state" id="empty-state">
307
- <h2>What can I help you with?</h2>
308
- <p>Experience the power of DeepSeek V4 Pro, ready to answer your questions and assist with complex tasks.</p>
 
 
309
  </div>
310
 
311
- <div class="message bot" style="display:none;" id="typing-indicator-wrapper">
312
- <div class="typing-indicator" id="typing-indicator">
313
- <div class="dot"></div>
314
- <div class="dot"></div>
315
- <div class="dot"></div>
 
 
 
 
 
 
 
316
  </div>
317
  </div>
318
  </div>
319
-
320
 
321
  <div id="input-container">
322
  <div class="input-wrapper">
323
- <textarea id="user-input" rows="1" placeholder="Type a message..."></textarea>
324
  <button id="send-btn" disabled>
325
- <svg viewBox="0 0 24 24">
326
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"></path>
327
- </svg>
328
  </button>
329
  </div>
330
  </div>
@@ -346,7 +381,7 @@
346
  try {
347
  client = await window.GradioClient.connect(window.location.origin);
348
  console.log("Connected to Gradio Server");
349
- userInput.placeholder = "Message DeepSeek-V4-Pro...";
350
  } catch (err) {
351
  console.error("Failed to connect to Gradio Server:", err);
352
  userInput.placeholder = "Failed to connect to server.";
@@ -356,7 +391,7 @@
356
  // Auto-resize textarea
357
  userInput.addEventListener('input', function() {
358
  this.style.height = 'auto';
359
- this.style.height = Math.min(this.scrollHeight, 150) + 'px';
360
  sendBtn.disabled = this.value.trim().length === 0;
361
  });
362
 
@@ -377,9 +412,20 @@
377
  emptyState.style.display = 'none';
378
  }
379
 
 
 
 
380
  const messageDiv = document.createElement('div');
381
  messageDiv.className = `message ${role}`;
382
 
 
 
 
 
 
 
 
 
383
  const contentDiv = document.createElement('div');
384
  contentDiv.className = 'message-content';
385
 
@@ -389,10 +435,12 @@
389
  contentDiv.textContent = content;
390
  }
391
 
 
392
  messageDiv.appendChild(contentDiv);
 
393
 
394
  // Insert before typing indicator wrapper if it's there
395
- chatContainer.insertBefore(messageDiv, typingIndicatorWrapper);
396
 
397
  scrollToBottom();
398
 
@@ -417,7 +465,7 @@
417
  addMessage('user', text);
418
 
419
  // Show typing indicator
420
- typingIndicatorWrapper.style.display = 'flex';
421
  typingIndicator.style.display = 'flex';
422
  scrollToBottom();
423
 
 
16
  </script>
17
  <style>
18
  :root {
19
+ --bg-color: #212121;
20
+ --text-color: #ececec;
21
+ --text-muted: #b4b4b4;
22
+ --input-bg: #2f2f2f;
23
+ --border-color: #424242;
24
+ --btn-bg: #ececec;
25
+ --btn-color: #212121;
26
+ --code-bg: #000000;
 
 
27
  }
28
 
29
  * {
 
33
  }
34
 
35
  body {
36
+ font-family: 'Inter', system-ui, sans-serif;
37
  background-color: var(--bg-color);
38
  color: var(--text-color);
39
  display: flex;
40
  justify-content: center;
41
  height: 100vh;
42
  overflow: hidden;
43
+ font-size: 16px;
44
  }
45
 
46
  #app {
47
  width: 100%;
 
48
  display: flex;
49
  flex-direction: column;
50
  height: 100vh;
51
  position: relative;
52
  }
53
 
54
+ /* Header */
55
  header {
56
+ padding: 12px 16px;
 
 
 
57
  display: flex;
58
  align-items: center;
59
+ position: absolute;
60
+ top: 0;
61
+ width: 100%;
62
  z-index: 10;
63
  }
64
 
65
  .title {
66
+ font-size: 1.1rem;
67
  font-weight: 600;
68
+ color: var(--text-muted);
69
+ cursor: pointer;
70
+ padding: 8px 12px;
71
+ border-radius: 8px;
72
+ transition: background 0.2s;
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 6px;
76
+ }
77
+
78
+ .title span {
79
+ font-size: 0.7em;
80
+ color: #888;
81
+ }
82
+
83
+ .title:hover {
84
+ background: rgba(255,255,255,0.1);
85
  }
86
 
87
  /* Chat Container */
88
  #chat-container {
89
  flex: 1;
90
  overflow-y: auto;
91
+ padding-top: 60px;
92
+ padding-bottom: 120px;
93
  display: flex;
94
  flex-direction: column;
 
95
  scroll-behavior: smooth;
96
  }
97
 
 
103
  background: transparent;
104
  }
105
  #chat-container::-webkit-scrollbar-thumb {
106
+ background: #555;
107
  border-radius: 4px;
108
  }
109
 
110
  /* Messages */
111
+ .message-wrapper {
112
+ width: 100%;
113
+ padding: 24px 16px;
114
+ }
115
+
116
  .message {
117
+ max-width: 768px;
118
+ margin: 0 auto;
119
  display: flex;
120
+ gap: 16px;
 
 
121
  }
122
 
123
+ .avatar {
124
+ width: 30px;
125
+ height: 30px;
126
+ border-radius: 50%;
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ font-size: 14px;
131
+ font-weight: 600;
132
+ flex-shrink: 0;
133
  }
134
 
135
+ .user .avatar {
136
+ background: #3b82f6;
137
+ color: white;
138
  }
139
 
140
+ .bot .avatar {
141
+ background: #10a37f;
142
+ color: white;
143
+ }
144
+
145
+ .bot .avatar svg {
146
+ width: 20px;
147
+ height: 20px;
148
+ fill: white;
149
  }
150
 
151
  .message-content {
152
+ flex: 1;
 
 
153
  line-height: 1.6;
154
+ word-wrap: break-word;
155
+ min-width: 0;
156
+ color: #ececec;
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
  /* Markdown Styles in Bot Message */
160
+ .message-content p {
161
+ margin-bottom: 1em;
162
  }
163
+ .message-content p:last-child {
164
  margin-bottom: 0;
165
  }
166
+ .message-content pre {
167
+ background: var(--code-bg);
168
+ padding: 12px 16px;
169
  border-radius: 8px;
170
  overflow-x: auto;
171
+ margin: 16px 0;
172
  border: 1px solid var(--border-color);
173
  }
174
+ .message-content code {
175
  font-family: 'JetBrains Mono', monospace;
176
+ font-size: 0.9em;
177
+ background: rgba(255, 255, 255, 0.1);
178
  padding: 2px 4px;
179
  border-radius: 4px;
180
  }
181
+ .message-content pre code {
182
  background: transparent;
183
  padding: 0;
184
+ font-size: 0.85em;
185
  }
186
 
187
  /* Input Area */
188
  #input-container {
189
+ position: absolute;
190
+ bottom: 0;
191
+ width: 100%;
192
+ background: linear-gradient(180deg, rgba(33,33,33,0) 0%, rgba(33,33,33,1) 30%);
193
+ padding: 24px 16px;
194
+ display: flex;
195
+ justify-content: center;
196
  }
197
 
198
  .input-wrapper {
199
  display: flex;
200
  align-items: flex-end;
201
  background: var(--input-bg);
 
202
  border-radius: 24px;
203
+ padding: 8px 12px;
204
+ width: 100%;
205
+ max-width: 768px;
206
+ position: relative;
207
+ box-shadow: 0 0 15px rgba(0,0,0,0.1);
208
  }
209
 
210
  .input-wrapper:focus-within {
211
+ background: #333333;
 
212
  }
213
 
214
  #user-input {
 
219
  font-size: 1rem;
220
  font-family: 'Inter', sans-serif;
221
  resize: none;
222
+ padding: 10px 48px 10px 12px;
223
+ max-height: 200px;
224
  min-height: 24px;
225
  outline: none;
226
  line-height: 1.5;
 
231
  }
232
 
233
  #send-btn {
234
+ position: absolute;
235
+ right: 12px;
236
+ bottom: 12px;
237
+ background: var(--btn-bg);
238
+ color: var(--btn-color);
239
  border: none;
240
+ width: 32px;
241
+ height: 32px;
242
  border-radius: 50%;
243
  display: flex;
244
  align-items: center;
245
  justify-content: center;
246
  cursor: pointer;
247
+ transition: opacity 0.2s;
 
 
 
 
248
  }
249
 
250
  #send-btn:hover {
251
+ opacity: 0.8;
 
252
  }
253
 
254
  #send-btn:disabled {
255
+ background: #424242;
256
+ color: #666;
257
  cursor: not-allowed;
 
 
258
  }
259
 
260
  #send-btn svg {
261
+ width: 16px;
262
+ height: 16px;
263
  fill: currentColor;
 
264
  }
265
 
266
  /* Loading Indicator */
267
  .typing-indicator {
268
+ display: flex;
269
  align-items: center;
270
  gap: 4px;
271
+ padding: 8px 0;
 
 
 
272
  width: fit-content;
 
273
  }
274
 
275
  .dot {
 
284
  .dot:nth-child(2) { animation-delay: -0.16s; }
285
 
286
  @keyframes bounce {
287
+ 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
288
+ 40% { transform: scale(1); opacity: 1; }
289
  }
290
 
291
  .empty-state {
 
296
  height: 100%;
297
  color: var(--text-muted);
298
  text-align: center;
299
+ padding: 0 20px;
300
+ margin-top: 40px;
301
+ }
302
+
303
+ .empty-state .logo {
304
+ width: 64px;
305
+ height: 64px;
306
+ background: white;
307
+ border-radius: 50%;
308
+ margin-bottom: 24px;
309
+ display: flex;
310
+ align-items: center;
311
+ justify-content: center;
312
+ }
313
+
314
+ .empty-state .logo svg {
315
+ width: 40px;
316
+ height: 40px;
317
+ fill: #212121;
318
  }
319
+
320
  .empty-state h2 {
321
+ font-size: 1.5rem;
322
+ font-weight: 500;
323
+ color: #ececec;
 
 
 
 
 
 
324
  }
325
  </style>
326
  </head>
 
328
 
329
  <div id="app">
330
  <header>
331
+ <div class="title">DeepSeek V4 Pro <span>▼</span></div>
332
  </header>
333
 
334
  <div id="chat-container">
335
  <div class="empty-state" id="empty-state">
336
+ <div class="logo">
337
+ <svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>
338
+ </div>
339
+ <h2>How can I help you today?</h2>
340
  </div>
341
 
342
+ <div class="message-wrapper" style="display:none;" id="typing-indicator-wrapper">
343
+ <div class="message bot">
344
+ <div class="avatar">
345
+ <svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>
346
+ </div>
347
+ <div class="message-content">
348
+ <div class="typing-indicator" id="typing-indicator">
349
+ <div class="dot"></div>
350
+ <div class="dot"></div>
351
+ <div class="dot"></div>
352
+ </div>
353
+ </div>
354
  </div>
355
  </div>
356
  </div>
 
357
 
358
  <div id="input-container">
359
  <div class="input-wrapper">
360
+ <textarea id="user-input" rows="1" placeholder="Message DeepSeek V4 Pro..."></textarea>
361
  <button id="send-btn" disabled>
362
+ <svg viewBox="0 0 24 24"><path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/></svg>
 
 
363
  </button>
364
  </div>
365
  </div>
 
381
  try {
382
  client = await window.GradioClient.connect(window.location.origin);
383
  console.log("Connected to Gradio Server");
384
+ userInput.placeholder = "Message DeepSeek V4 Pro...";
385
  } catch (err) {
386
  console.error("Failed to connect to Gradio Server:", err);
387
  userInput.placeholder = "Failed to connect to server.";
 
391
  // Auto-resize textarea
392
  userInput.addEventListener('input', function() {
393
  this.style.height = 'auto';
394
+ this.style.height = Math.min(this.scrollHeight, 200) + 'px';
395
  sendBtn.disabled = this.value.trim().length === 0;
396
  });
397
 
 
412
  emptyState.style.display = 'none';
413
  }
414
 
415
+ const wrapperDiv = document.createElement('div');
416
+ wrapperDiv.className = 'message-wrapper';
417
+
418
  const messageDiv = document.createElement('div');
419
  messageDiv.className = `message ${role}`;
420
 
421
+ const avatarDiv = document.createElement('div');
422
+ avatarDiv.className = 'avatar';
423
+ if (role === 'user') {
424
+ avatarDiv.textContent = 'U';
425
+ } else {
426
+ avatarDiv.innerHTML = '<svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>';
427
+ }
428
+
429
  const contentDiv = document.createElement('div');
430
  contentDiv.className = 'message-content';
431
 
 
435
  contentDiv.textContent = content;
436
  }
437
 
438
+ messageDiv.appendChild(avatarDiv);
439
  messageDiv.appendChild(contentDiv);
440
+ wrapperDiv.appendChild(messageDiv);
441
 
442
  // Insert before typing indicator wrapper if it's there
443
+ chatContainer.insertBefore(wrapperDiv, typingIndicatorWrapper);
444
 
445
  scrollToBottom();
446
 
 
465
  addMessage('user', text);
466
 
467
  // Show typing indicator
468
+ typingIndicatorWrapper.style.display = 'block';
469
  typingIndicator.style.display = 'flex';
470
  scrollToBottom();
471