nayohan commited on
Commit
eaa3ccd
·
verified ·
1 Parent(s): 6fa9265

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +384 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Sample Chat
3
- emoji: 🐨
4
  colorFrom: pink
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: sample-chat
3
+ emoji: 🐳
4
  colorFrom: pink
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,384 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
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>ChatGPT Clone</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* Custom scrollbar */
11
+ ::-webkit-scrollbar {
12
+ width: 8px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 4px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* Chat container animation */
26
+ @keyframes fadeIn {
27
+ from { opacity: 0; transform: translateY(10px); }
28
+ to { opacity: 1; transform: translateY(0); }
29
+ }
30
+
31
+ .message-animation {
32
+ animation: fadeIn 0.3s ease-out forwards;
33
+ }
34
+
35
+ /* Typing indicator */
36
+ .typing-indicator span {
37
+ display: inline-block;
38
+ width: 8px;
39
+ height: 8px;
40
+ border-radius: 50%;
41
+ background-color: #9ca3af;
42
+ margin: 0 2px;
43
+ }
44
+
45
+ .typing-indicator span:nth-child(1) {
46
+ animation: bounce 1s infinite;
47
+ }
48
+
49
+ .typing-indicator span:nth-child(2) {
50
+ animation: bounce 1s infinite 0.2s;
51
+ }
52
+
53
+ .typing-indicator span:nth-child(3) {
54
+ animation: bounce 1s infinite 0.4s;
55
+ }
56
+
57
+ @keyframes bounce {
58
+ 0%, 100% { transform: translateY(0); }
59
+ 50% { transform: translateY(-5px); }
60
+ }
61
+ </style>
62
+ </head>
63
+ <body class="bg-gray-50 h-screen flex flex-col">
64
+ <!-- Sidebar -->
65
+ <div class="fixed inset-y-0 left-0 w-64 bg-gray-900 text-white p-4 hidden md:block">
66
+ <div class="flex items-center mb-8">
67
+ <i class="fas fa-robot text-xl mr-2 text-green-400"></i>
68
+ <h1 class="text-xl font-bold">ChatGPT</h1>
69
+ </div>
70
+
71
+ <button class="w-full bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded mb-4 flex items-center">
72
+ <i class="fas fa-plus mr-2"></i> New Chat
73
+ </button>
74
+
75
+ <div class="mb-6">
76
+ <h3 class="text-gray-400 uppercase text-xs font-semibold mb-2">Today</h3>
77
+ <ul>
78
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
79
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
80
+ <span>Getting started with AI</span>
81
+ </li>
82
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
83
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
84
+ <span>JavaScript tips</span>
85
+ </li>
86
+ </ul>
87
+ </div>
88
+
89
+ <div class="mb-6">
90
+ <h3 class="text-gray-400 uppercase text-xs font-semibold mb-2">Yesterday</h3>
91
+ <ul>
92
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
93
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
94
+ <span>Python programming</span>
95
+ </li>
96
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
97
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
98
+ <span>AI ethics discussion</span>
99
+ </li>
100
+ </ul>
101
+ </div>
102
+
103
+ <div class="absolute bottom-0 left-0 right-0 p-4 border-t border-gray-700">
104
+ <div class="flex items-center">
105
+ <div class="w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center mr-2">
106
+ <i class="fas fa-user"></i>
107
+ </div>
108
+ <span>User Account</span>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- Mobile header -->
114
+ <header class="md:hidden bg-gray-900 text-white p-4 flex items-center justify-between">
115
+ <button id="menuButton" class="text-white">
116
+ <i class="fas fa-bars"></i>
117
+ </button>
118
+ <div class="flex items-center">
119
+ <i class="fas fa-robot text-xl mr-2 text-green-400"></i>
120
+ <h1 class="text-xl font-bold">ChatGPT</h1>
121
+ </div>
122
+ <div class="w-6"></div> <!-- Spacer for alignment -->
123
+ </header>
124
+
125
+ <!-- Mobile sidebar (hidden by default) -->
126
+ <div id="mobileSidebar" class="fixed inset-0 bg-gray-900 text-white p-4 z-50 hidden">
127
+ <div class="flex justify-between items-center mb-8">
128
+ <button id="closeMenuButton" class="text-white">
129
+ <i class="fas fa-times"></i>
130
+ </button>
131
+ <div class="flex items-center">
132
+ <i class="fas fa-robot text-xl mr-2 text-green-400"></i>
133
+ <h1 class="text-xl font-bold">ChatGPT</h1>
134
+ </div>
135
+ </div>
136
+
137
+ <button class="w-full bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded mb-4 flex items-center">
138
+ <i class="fas fa-plus mr-2"></i> New Chat
139
+ </button>
140
+
141
+ <div class="mb-6">
142
+ <h3 class="text-gray-400 uppercase text-xs font-semibold mb-2">Today</h3>
143
+ <ul>
144
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
145
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
146
+ <span>Getting started with AI</span>
147
+ </li>
148
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
149
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
150
+ <span>JavaScript tips</span>
151
+ </li>
152
+ </ul>
153
+ </div>
154
+
155
+ <div class="mb-6">
156
+ <h3 class="text-gray-400 uppercase text-xs font-semibold mb-2">Yesterday</h3>
157
+ <ul>
158
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
159
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
160
+ <span>Python programming</span>
161
+ </li>
162
+ <li class="py-2 px-2 hover:bg-gray-700 rounded cursor-pointer flex items-center">
163
+ <i class="fas fa-comment-alt mr-2 text-gray-400"></i>
164
+ <span>AI ethics discussion</span>
165
+ </li>
166
+ </ul>
167
+ </div>
168
+
169
+ <div class="absolute bottom-0 left-0 right-0 p-4 border-t border-gray-700">
170
+ <div class="flex items-center">
171
+ <div class="w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center mr-2">
172
+ <i class="fas fa-user"></i>
173
+ </div>
174
+ <span>User Account</span>
175
+ </div>
176
+ </div>
177
+ </div>
178
+
179
+ <!-- Main content -->
180
+ <main class="flex-1 md:ml-64 overflow-hidden flex flex-col">
181
+ <!-- Chat container -->
182
+ <div id="chatContainer" class="flex-1 overflow-y-auto p-4 space-y-6">
183
+ <!-- Welcome message -->
184
+ <div class="max-w-3xl mx-auto">
185
+ <div class="flex items-start space-x-4">
186
+ <div class="w-8 h-8 rounded-full bg-green-500 flex items-center justify-center text-white">
187
+ <i class="fas fa-robot"></i>
188
+ </div>
189
+ <div class="bg-white p-4 rounded-lg shadow-sm flex-1">
190
+ <h2 class="text-xl font-bold mb-2">Hello! How can I help you today?</h2>
191
+ <p class="text-gray-600">I'm an AI assistant here to answer your questions, help with creative tasks, and provide information on a wide range of topics. What would you like to know?</p>
192
+
193
+ <div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
194
+ <div class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer">
195
+ <h3 class="font-semibold">Explain quantum computing</h3>
196
+ <p class="text-sm text-gray-500">in simple terms</p>
197
+ </div>
198
+ <div class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer">
199
+ <h3 class="font-semibold">Suggest fun activities</h3>
200
+ <p class="text-sm text-gray-500">for a family with kids</p>
201
+ </div>
202
+ <div class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer">
203
+ <h3 class="font-semibold">Write a poem</h3>
204
+ <p class="text-sm text-gray-500">about artificial intelligence</p>
205
+ </div>
206
+ <div class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer">
207
+ <h3 class="font-semibold">Help debug this code</h3>
208
+ <p class="text-sm text-gray-500">that's not working</p>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ </div>
213
+ </div>
214
+ </div>
215
+
216
+ <!-- Input area -->
217
+ <div class="p-4 border-t border-gray-200 bg-white">
218
+ <div class="max-w-3xl mx-auto relative">
219
+ <div class="relative">
220
+ <textarea
221
+ id="messageInput"
222
+ rows="1"
223
+ placeholder="Message ChatGPT..."
224
+ class="w-full p-4 pr-16 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent resize-none"
225
+ style="min-height: 60px; max-height: 200px;"
226
+ ></textarea>
227
+ <button
228
+ id="sendButton"
229
+ class="absolute right-3 bottom-3 w-8 h-8 rounded-full bg-green-500 text-white flex items-center justify-center hover:bg-green-600 disabled:bg-gray-300 disabled:cursor-not-allowed"
230
+ disabled
231
+ >
232
+ <i class="fas fa-paper-plane"></i>
233
+ </button>
234
+ </div>
235
+ <p class="text-xs text-gray-500 mt-2 text-center">ChatGPT can make mistakes. Consider checking important information.</p>
236
+ </div>
237
+ </div>
238
+ </main>
239
+
240
+ <script>
241
+ // Mobile menu toggle
242
+ const menuButton = document.getElementById('menuButton');
243
+ const closeMenuButton = document.getElementById('closeMenuButton');
244
+ const mobileSidebar = document.getElementById('mobileSidebar');
245
+
246
+ menuButton.addEventListener('click', () => {
247
+ mobileSidebar.classList.remove('hidden');
248
+ });
249
+
250
+ closeMenuButton.addEventListener('click', () => {
251
+ mobileSidebar.classList.add('hidden');
252
+ });
253
+
254
+ // Auto-resize textarea
255
+ const messageInput = document.getElementById('messageInput');
256
+ const sendButton = document.getElementById('sendButton');
257
+
258
+ messageInput.addEventListener('input', function() {
259
+ this.style.height = 'auto';
260
+ this.style.height = (this.scrollHeight) + 'px';
261
+
262
+ // Enable/disable send button based on input
263
+ sendButton.disabled = this.value.trim() === '';
264
+ });
265
+
266
+ // Send message functionality
267
+ sendButton.addEventListener('click', sendMessage);
268
+ messageInput.addEventListener('keydown', function(e) {
269
+ if (e.key === 'Enter' && !e.shiftKey) {
270
+ e.preventDefault();
271
+ sendMessage();
272
+ }
273
+ });
274
+
275
+ function sendMessage() {
276
+ const message = messageInput.value.trim();
277
+ if (!message) return;
278
+
279
+ // Add user message to chat
280
+ addMessage(message, 'user');
281
+
282
+ // Clear input
283
+ messageInput.value = '';
284
+ messageInput.style.height = '60px';
285
+ sendButton.disabled = true;
286
+
287
+ // Show typing indicator
288
+ showTypingIndicator();
289
+
290
+ // Simulate AI response after a delay
291
+ setTimeout(() => {
292
+ removeTypingIndicator();
293
+ const responses = [
294
+ "I'm an AI assistant designed to provide helpful and harmless responses.",
295
+ "That's an interesting question! Here's what I know about that topic...",
296
+ "I can certainly help with that. Let me explain how this works...",
297
+ "Based on my training data, here's the information you requested...",
298
+ "I'd be happy to assist! Here are some key points to consider..."
299
+ ];
300
+ const randomResponse = responses[Math.floor(Math.random() * responses.length)];
301
+ addMessage(randomResponse, 'ai');
302
+ }, 1500);
303
+ }
304
+
305
+ function addMessage(text, sender) {
306
+ const chatContainer = document.getElementById('chatContainer');
307
+ const messageDiv = document.createElement('div');
308
+ messageDiv.className = 'max-w-3xl mx-auto message-animation';
309
+
310
+ if (sender === 'user') {
311
+ messageDiv.innerHTML = `
312
+ <div class="flex items-start space-x-4 justify-end">
313
+ <div class="bg-green-100 p-4 rounded-lg shadow-sm flex-1 max-w-full">
314
+ <p class="text-gray-800">${text}</p>
315
+ </div>
316
+ <div class="w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white">
317
+ <i class="fas fa-user"></i>
318
+ </div>
319
+ </div>
320
+ `;
321
+ } else {
322
+ messageDiv.innerHTML = `
323
+ <div class="flex items-start space-x-4">
324
+ <div class="w-8 h-8 rounded-full bg-green-500 flex items-center justify-center text-white">
325
+ <i class="fas fa-robot"></i>
326
+ </div>
327
+ <div class="bg-white p-4 rounded-lg shadow-sm flex-1">
328
+ <p class="text-gray-800">${text}</p>
329
+ </div>
330
+ </div>
331
+ `;
332
+ }
333
+
334
+ chatContainer.appendChild(messageDiv);
335
+ chatContainer.scrollTop = chatContainer.scrollHeight;
336
+ }
337
+
338
+ function showTypingIndicator() {
339
+ const chatContainer = document.getElementById('chatContainer');
340
+ const typingDiv = document.createElement('div');
341
+ typingDiv.className = 'max-w-3xl mx-auto message-animation';
342
+ typingDiv.id = 'typingIndicator';
343
+
344
+ typingDiv.innerHTML = `
345
+ <div class="flex items-start space-x-4">
346
+ <div class="w-8 h-8 rounded-full bg-green-500 flex items-center justify-center text-white">
347
+ <i class="fas fa-robot"></i>
348
+ </div>
349
+ <div class="bg-white p-4 rounded-lg shadow-sm flex-1">
350
+ <div class="typing-indicator">
351
+ <span></span>
352
+ <span></span>
353
+ <span></span>
354
+ </div>
355
+ </div>
356
+ </div>
357
+ `;
358
+
359
+ chatContainer.appendChild(typingDiv);
360
+ chatContainer.scrollTop = chatContainer.scrollHeight;
361
+ }
362
+
363
+ function removeTypingIndicator() {
364
+ const typingIndicator = document.getElementById('typingIndicator');
365
+ if (typingIndicator) {
366
+ typingIndicator.remove();
367
+ }
368
+ }
369
+
370
+ // Example conversation starter buttons
371
+ document.querySelectorAll('.grid div').forEach(button => {
372
+ button.addEventListener('click', () => {
373
+ const question = button.querySelector('h3').textContent +
374
+ (button.querySelector('p') ? ' ' + button.querySelector('p').textContent : '');
375
+ messageInput.value = question;
376
+ messageInput.style.height = 'auto';
377
+ messageInput.style.height = (messageInput.scrollHeight) + 'px';
378
+ sendButton.disabled = false;
379
+ messageInput.focus();
380
+ });
381
+ });
382
+ </script>
383
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=nayohan/sample-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
384
+ </html>