axanto commited on
Commit
054bff1
·
verified ·
1 Parent(s): 5febbab

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +320 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Chatbot Try
3
- emoji: 🔥
4
- colorFrom: yellow
5
- colorTo: gray
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: chatbot-try
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: green
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,320 @@
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>ChatBot with Sidebar</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
+ border-radius: 10px;
17
+ }
18
+ ::-webkit-scrollbar-thumb {
19
+ background: #888;
20
+ border-radius: 10px;
21
+ }
22
+ ::-webkit-scrollbar-thumb:hover {
23
+ background: #555;
24
+ }
25
+
26
+ /* Animation for messages */
27
+ @keyframes fadeIn {
28
+ from { opacity: 0; transform: translateY(10px); }
29
+ to { opacity: 1; transform: translateY(0); }
30
+ }
31
+
32
+ .message {
33
+ animation: fadeIn 0.3s ease-out;
34
+ }
35
+
36
+ /* Mobile sidebar toggle */
37
+ @media (max-width: 768px) {
38
+ .sidebar {
39
+ transform: translateX(-100%);
40
+ transition: transform 0.3s ease-in-out;
41
+ }
42
+ .sidebar.active {
43
+ transform: translateX(0);
44
+ }
45
+ .overlay {
46
+ display: none;
47
+ position: fixed;
48
+ top: 0;
49
+ left: 0;
50
+ right: 0;
51
+ bottom: 0;
52
+ background-color: rgba(0, 0, 0, 0.5);
53
+ z-index: 10;
54
+ }
55
+ .overlay.active {
56
+ display: block;
57
+ }
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="bg-gray-100 h-screen overflow-hidden">
62
+ <div class="flex h-full">
63
+ <!-- Sidebar -->
64
+ <div class="sidebar bg-indigo-900 text-white w-64 md:w-72 flex-shrink-0 flex flex-col z-20">
65
+ <!-- Sidebar Header -->
66
+ <div class="p-4 border-b border-indigo-800 flex items-center justify-between">
67
+ <div class="flex items-center space-x-3">
68
+ <div class="w-10 h-10 rounded-full bg-indigo-700 flex items-center justify-center">
69
+ <i class="fas fa-robot text-xl"></i>
70
+ </div>
71
+ <h2 class="text-xl font-semibold">ChatBot</h2>
72
+ </div>
73
+ <button id="closeSidebar" class="md:hidden text-gray-300 hover:text-white">
74
+ <i class="fas fa-times"></i>
75
+ </button>
76
+ </div>
77
+
78
+ <!-- Sidebar Content -->
79
+ <div class="flex-1 overflow-y-auto p-4 space-y-4">
80
+ <div>
81
+ <h3 class="text-sm uppercase text-indigo-300 mb-2">Recent Chats</h3>
82
+ <div class="space-y-1">
83
+ <div class="p-2 rounded-lg bg-indigo-800 cursor-pointer hover:bg-indigo-700 transition">
84
+ <p class="font-medium">Today's Chat</p>
85
+ <p class="text-xs text-indigo-300">Just now</p>
86
+ </div>
87
+ <div class="p-2 rounded-lg cursor-pointer hover:bg-indigo-800 transition">
88
+ <p class="font-medium">Product Questions</p>
89
+ <p class="text-xs text-indigo-300">Yesterday</p>
90
+ </div>
91
+ <div class="p-2 rounded-lg cursor-pointer hover:bg-indigo-800 transition">
92
+ <p class="font-medium">Technical Support</p>
93
+ <p class="text-xs text-indigo-300">2 days ago</p>
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ <div>
99
+ <h3 class="text-sm uppercase text-indigo-300 mb-2">Quick Actions</h3>
100
+ <div class="space-y-2">
101
+ <button class="w-full flex items-center space-x-2 p-2 rounded-lg hover:bg-indigo-800 transition">
102
+ <i class="fas fa-question-circle"></i>
103
+ <span>Help Center</span>
104
+ </button>
105
+ <button class="w-full flex items-center space-x-2 p-2 rounded-lg hover:bg-indigo-800 transition">
106
+ <i class="fas fa-cog"></i>
107
+ <span>Settings</span>
108
+ </button>
109
+ <button class="w-full flex items-center space-x-2 p-2 rounded-lg hover:bg-indigo-800 transition">
110
+ <i class="fas fa-history"></i>
111
+ <span>History</span>
112
+ </button>
113
+ </div>
114
+ </div>
115
+
116
+ <div>
117
+ <h3 class="text-sm uppercase text-indigo-300 mb-2">Suggested Prompts</h3>
118
+ <div class="space-y-2">
119
+ <button class="prompt-btn w-full text-left p-2 bg-indigo-800 rounded-lg hover:bg-indigo-700 transition">
120
+ "How do I reset my password?"
121
+ </button>
122
+ <button class="prompt-btn w-full text-left p-2 bg-indigo-800 rounded-lg hover:bg-indigo-700 transition">
123
+ "What are your business hours?"
124
+ </button>
125
+ <button class="prompt-btn w-full text-left p-2 bg-indigo-800 rounded-lg hover:bg-indigo-700 transition">
126
+ "Tell me about your pricing"
127
+ </button>
128
+ </div>
129
+ </div>
130
+ </div>
131
+
132
+ <!-- Sidebar Footer -->
133
+ <div class="p-4 border-t border-indigo-800">
134
+ <div class="flex items-center space-x-3">
135
+ <div class="w-10 h-10 rounded-full bg-indigo-700 flex items-center justify-center">
136
+ <i class="fas fa-user"></i>
137
+ </div>
138
+ <div>
139
+ <p class="font-medium">John Doe</p>
140
+ <p class="text-xs text-indigo-300">Free Plan</p>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <!-- Mobile overlay -->
147
+ <div id="overlay" class="overlay"></div>
148
+
149
+ <!-- Main Chat Area -->
150
+ <div class="flex-1 flex flex-col h-full overflow-hidden">
151
+ <!-- Chat Header -->
152
+ <div class="bg-white border-b p-4 flex items-center justify-between">
153
+ <div class="flex items-center space-x-3">
154
+ <button id="toggleSidebar" class="md:hidden text-gray-600 hover:text-gray-900">
155
+ <i class="fas fa-bars"></i>
156
+ </button>
157
+ <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
158
+ <i class="fas fa-robot text-indigo-600"></i>
159
+ </div>
160
+ <h2 class="font-semibold">Assistant</h2>
161
+ </div>
162
+ <div class="flex items-center space-x-4">
163
+ <button class="text-gray-500 hover:text-gray-700">
164
+ <i class="fas fa-ellipsis-v"></i>
165
+ </button>
166
+ </div>
167
+ </div>
168
+
169
+ <!-- Messages Container -->
170
+ <div id="messages" class="flex-1 overflow-y-auto p-4 space-y-4 bg-gray-50">
171
+ <!-- Bot welcome message -->
172
+ <div class="message flex space-x-2">
173
+ <div class="flex-shrink-0">
174
+ <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
175
+ <i class="fas fa-robot text-indigo-600"></i>
176
+ </div>
177
+ </div>
178
+ <div class="max-w-[80%]">
179
+ <div class="bg-white p-3 rounded-lg rounded-tl-none shadow-sm">
180
+ <p>Hello! I'm your AI assistant. How can I help you today?</p>
181
+ </div>
182
+ <p class="text-xs text-gray-500 mt-1">Just now</p>
183
+ </div>
184
+ </div>
185
+ </div>
186
+
187
+ <!-- Input Area -->
188
+ <div class="bg-white border-t p-4">
189
+ <form id="chatForm" class="flex items-center space-x-2">
190
+ <button type="button" class="w-10 h-10 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition">
191
+ <i class="fas fa-plus text-gray-600"></i>
192
+ </button>
193
+ <div class="flex-1 relative">
194
+ <input
195
+ id="messageInput"
196
+ type="text"
197
+ placeholder="Type your message..."
198
+ class="w-full p-3 pr-12 rounded-full bg-gray-100 focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:bg-white transition"
199
+ >
200
+ <button type="button" class="absolute right-3 top-3 text-gray-500 hover:text-indigo-600">
201
+ <i class="far fa-smile"></i>
202
+ </button>
203
+ </div>
204
+ <button type="submit" class="w-10 h-10 rounded-full bg-indigo-600 hover:bg-indigo-700 flex items-center justify-center text-white transition">
205
+ <i class="fas fa-paper-plane"></i>
206
+ </button>
207
+ </form>
208
+ <p class="text-xs text-gray-500 mt-2 text-center">AI Assistant may produce inaccurate information</p>
209
+ </div>
210
+ </div>
211
+ </div>
212
+
213
+ <script>
214
+ document.addEventListener('DOMContentLoaded', function() {
215
+ const chatForm = document.getElementById('chatForm');
216
+ const messageInput = document.getElementById('messageInput');
217
+ const messagesContainer = document.getElementById('messages');
218
+ const toggleSidebar = document.getElementById('toggleSidebar');
219
+ const closeSidebar = document.getElementById('closeSidebar');
220
+ const sidebar = document.querySelector('.sidebar');
221
+ const overlay = document.getElementById('overlay');
222
+ const promptButtons = document.querySelectorAll('.prompt-btn');
223
+
224
+ // Toggle sidebar on mobile
225
+ toggleSidebar.addEventListener('click', () => {
226
+ sidebar.classList.add('active');
227
+ overlay.classList.add('active');
228
+ });
229
+
230
+ closeSidebar.addEventListener('click', () => {
231
+ sidebar.classList.remove('active');
232
+ overlay.classList.remove('active');
233
+ });
234
+
235
+ overlay.addEventListener('click', () => {
236
+ sidebar.classList.remove('active');
237
+ overlay.classList.remove('active');
238
+ });
239
+
240
+ // Handle form submission
241
+ chatForm.addEventListener('submit', function(e) {
242
+ e.preventDefault();
243
+ const message = messageInput.value.trim();
244
+ if (message) {
245
+ addMessage(message, 'user');
246
+ messageInput.value = '';
247
+
248
+ // Simulate bot response after a short delay
249
+ setTimeout(() => {
250
+ const botResponses = [
251
+ "I understand your question about '" + message + "'. Let me look that up for you.",
252
+ "That's an interesting question! Here's what I found...",
253
+ "I can help with that. " + message + " is related to...",
254
+ "Thanks for asking! The answer to '" + message + "' is..."
255
+ ];
256
+ const randomResponse = botResponses[Math.floor(Math.random() * botResponses.length)];
257
+ addMessage(randomResponse, 'bot');
258
+ }, 1000 + Math.random() * 2000); // Random delay between 1-3 seconds
259
+ }
260
+ });
261
+
262
+ // Add click handlers for prompt buttons
263
+ promptButtons.forEach(button => {
264
+ button.addEventListener('click', function() {
265
+ const prompt = this.textContent.trim().replace(/"/g, '');
266
+ messageInput.value = prompt;
267
+ messageInput.focus();
268
+ });
269
+ });
270
+
271
+ // Function to add a new message to the chat
272
+ function addMessage(text, sender) {
273
+ const messageDiv = document.createElement('div');
274
+ messageDiv.className = `message flex space-x-2 ${sender === 'user' ? 'justify-end' : ''}`;
275
+
276
+ if (sender === 'user') {
277
+ messageDiv.innerHTML = `
278
+ <div class="max-w-[80%]">
279
+ <div class="bg-indigo-600 text-white p-3 rounded-lg rounded-tr-none shadow-sm">
280
+ <p>${text}</p>
281
+ </div>
282
+ <p class="text-xs text-gray-500 mt-1 text-right">Just now</p>
283
+ </div>
284
+ <div class="flex-shrink-0">
285
+ <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
286
+ <i class="fas fa-user text-indigo-600"></i>
287
+ </div>
288
+ </div>
289
+ `;
290
+ } else {
291
+ messageDiv.innerHTML = `
292
+ <div class="flex-shrink-0">
293
+ <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
294
+ <i class="fas fa-robot text-indigo-600"></i>
295
+ </div>
296
+ </div>
297
+ <div class="max-w-[80%]">
298
+ <div class="bg-white p-3 rounded-lg rounded-tl-none shadow-sm">
299
+ <p>${text}</p>
300
+ </div>
301
+ <p class="text-xs text-gray-500 mt-1">Just now</p>
302
+ </div>
303
+ `;
304
+ }
305
+
306
+ messagesContainer.appendChild(messageDiv);
307
+ messagesContainer.scrollTop = messagesContainer.scrollHeight;
308
+ }
309
+
310
+ // Allow pressing Enter to send message (but Shift+Enter for new line)
311
+ messageInput.addEventListener('keydown', function(e) {
312
+ if (e.key === 'Enter' && !e.shiftKey) {
313
+ e.preventDefault();
314
+ chatForm.dispatchEvent(new Event('submit'));
315
+ }
316
+ });
317
+ });
318
+ </script>
319
+ <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=axanto/chatbot-try" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
320
+ </html>