Sonata71 commited on
Commit
1b7bfa7
·
verified ·
1 Parent(s): b265e3e

i want to create site web where can i talk with api deepseek - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +418 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ai Deepseek
3
- emoji: 🐢
4
  colorFrom: purple
5
- colorTo: indigo
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: ai-deepseek
3
+ emoji: 🐳
4
  colorFrom: purple
5
+ colorTo: pink
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,418 @@
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>DeepSeek Chat Interface</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
+ .custom-scrollbar::-webkit-scrollbar {
12
+ width: 6px;
13
+ }
14
+ .custom-scrollbar::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ border-radius: 10px;
17
+ }
18
+ .custom-scrollbar::-webkit-scrollbar-thumb {
19
+ background: #888;
20
+ border-radius: 10px;
21
+ }
22
+ .custom-scrollbar::-webkit-scrollbar-thumb:hover {
23
+ background: #555;
24
+ }
25
+
26
+ /* Chat bubble animation */
27
+ @keyframes bubbleIn {
28
+ 0% { opacity: 0; transform: translateY(10px); }
29
+ 100% { opacity: 1; transform: translateY(0); }
30
+ }
31
+ .bubble-in {
32
+ animation: bubbleIn 0.3s ease-out forwards;
33
+ }
34
+
35
+ /* Background pattern */
36
+ body::before {
37
+ content: "";
38
+ position: fixed;
39
+ top: 0;
40
+ left: 0;
41
+ width: 100%;
42
+ height: 100%;
43
+ background-image: radial-gradient(circle at 10% 20%, rgba(200, 200, 200, 0.1) 0%, rgba(200, 200, 200, 0.05) 90%);
44
+ pointer-events: none;
45
+ z-index: -1;
46
+ }
47
+
48
+ /* Typing indicator animation */
49
+ @keyframes typingDot {
50
+ 0% { transform: translateY(0); }
51
+ 33% { transform: translateY(-5px); }
52
+ 66% { transform: translateY(0); }
53
+ }
54
+ .typing-dot:nth-child(1) { animation: typingDot 1.5s infinite ease-in-out; }
55
+ .typing-dot:nth-child(2) { animation: typingDot 1.5s infinite ease-in-out 0.2s; }
56
+ .typing-dot:nth-child(3) { animation: typingDot 1.5s infinite ease-in-out 0.4s; }
57
+ </style>
58
+ </head>
59
+ <body class="bg-gray-50 text-gray-800 font-sans h-screen flex flex-col">
60
+ <!-- Header -->
61
+ <header class="bg-gradient-to-r from-blue-600 to-purple-600 text-white p-4 shadow-md">
62
+ <div class="container mx-auto flex items-center justify-between">
63
+ <div class="flex items-center space-x-3">
64
+ <div class="w-10 h-10 bg-white rounded-full flex items-center justify-center">
65
+ <i class="fas fa-robot text-blue-600 text-xl"></i>
66
+ </div>
67
+ <h1 class="text-xl md:text-2xl font-bold">DeepSeek AI Chat</h1>
68
+ </div>
69
+ <div class="flex items-center space-x-4">
70
+ <button id="settings-btn" class="hover:bg-white/10 p-2 rounded-full transition">
71
+ <i class="fas fa-cog"></i>
72
+ </button>
73
+ <button id="history-btn" class="hover:bg-white/10 p-2 rounded-full transition">
74
+ <i class="fas fa-history"></i>
75
+ </button>
76
+ </div>
77
+ </div>
78
+ </header>
79
+
80
+ <!-- Main content -->
81
+ <main class="flex-1 flex flex-col container mx-auto p-4 max-w-5xl overflow-hidden">
82
+ <!-- Chat container -->
83
+ <div id="chat-container" class="flex-1 overflow-y-auto custom-scrollbar mb-4 space-y-4 p-2">
84
+ <!-- Welcome message -->
85
+ <div class="flex justify-start">
86
+ <div class="max-w-[80%] md:max-w-[70%] bubble-in">
87
+ <div class="bg-white p-4 rounded-2xl rounded-tl-none shadow-md">
88
+ <div class="flex items-center space-x-2 mb-2">
89
+ <div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center">
90
+ <i class="fas fa-robot text-purple-600"></i>
91
+ </div>
92
+ <span class="font-semibold text-gray-700">DeepSeek AI</span>
93
+ </div>
94
+ <p class="text-gray-700">Hello! I'm DeepSeek AI. How can I assist you today? I can help with answering questions, providing explanations, analyzing data, and much more.</p>
95
+ </div>
96
+ <p class="text-xs text-gray-500 mt-1 ml-2">Today at <span id="welcome-time"></span></p>
97
+ </div>
98
+ </div>
99
+ </div>
100
+
101
+ <!-- Input area -->
102
+ <div class="bg-white rounded-xl shadow-lg p-4 border border-gray-200">
103
+ <div class="flex items-end space-x-2">
104
+ <div class="flex-1 relative">
105
+ <textarea
106
+ id="message-input"
107
+ rows="1"
108
+ placeholder="Message DeepSeek AI..."
109
+ class="w-full p-3 pr-12 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none transition duration-200 max-h-32 min-h-[50px]"
110
+ required
111
+ ></textarea>
112
+ <button id="send-btn" class="absolute right-3 bottom-3 text-blue-600 hover:text-blue-800 transition">
113
+ <i class="fas fa-paper-plane text-xl"></i>
114
+ </button>
115
+ </div>
116
+ <button id="mic-btn" class="p-3 bg-gray-100 hover:bg-gray-200 rounded-lg transition">
117
+ <i class="fas fa-microphone text-gray-600"></i>
118
+ </button>
119
+ </div>
120
+ <p class="text-xs text-gray-500 mt-2 text-center">DeepSeek AI can make mistakes. Consider checking important information.</p>
121
+ </div>
122
+ </main>
123
+
124
+ <!-- Modals -->
125
+ <!-- API Settings Modal -->
126
+ <div id="settings-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden">
127
+ <div class="bg-white rounded-xl max-w-md w-full p-6 animate-pop-in">
128
+ <div class="flex justify-between items-center mb-4">
129
+ <h3 class="text-xl font-bold">API Settings</h3>
130
+ <button id="close-settings" class="text-gray-500 hover:text-gray-700">
131
+ <i class="fas fa-times"></i>
132
+ </button>
133
+ </div>
134
+ <div class="space-y-4">
135
+ <div>
136
+ <label for="api-key" class="block text-sm font-medium text-gray-700 mb-1">API Key</label>
137
+ <div class="relative">
138
+ <input
139
+ type="password"
140
+ id="api-key"
141
+ placeholder="Enter your DeepSeek API key"
142
+ class="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"
143
+ >
144
+ <button id="toggle-key" class="absolute right-2 top-2 text-gray-500">
145
+ <i class="fas fa-eye"></i>
146
+ </button>
147
+ </div>
148
+ </div>
149
+ <div>
150
+ <label for="model-select" class="block text-sm font-medium text-gray-700 mb-1">Model</label>
151
+ <select
152
+ id="model-select"
153
+ class="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"
154
+ >
155
+ <option value="deepseek-chat">DeepSeek Chat</option>
156
+ <option value="deepseek-r2">DeepSeek R2</option>
157
+ <option value="deepseek-pro">DeepSeek Pro</option>
158
+ </select>
159
+ </div>
160
+ <div>
161
+ <label for="temperature" class="block text-sm font-medium text-gray-700 mb-1">
162
+ Temperature: <span id="temp-value">0.7</span>
163
+ </label>
164
+ <input
165
+ type="range"
166
+ id="temperature"
167
+ min="0"
168
+ max="1"
169
+ step="0.1"
170
+ value="0.7"
171
+ class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"
172
+ >
173
+ </div>
174
+ </div>
175
+ <div class="mt-6 flex justify-end space-x-3">
176
+ <button id="cancel-settings" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50">
177
+ Cancel
178
+ </button>
179
+ <button id="save-settings" class="px-4 py-2 bg-blue-600 rounded-md text-white hover:bg-blue-700">
180
+ Save Settings
181
+ </button>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
186
+ <!-- Chat History Modal -->
187
+ <div id="history-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden">
188
+ <div class="bg-white rounded-xl max-w-2xl w-full max-h-[80vh] flex flex-col animate-pop-in">
189
+ <div class="flex justify-between items-center border-b p-4">
190
+ <h3 class="text-xl font-bold">Chat History</h3>
191
+ <button id="close-history" class="text-gray-500 hover:text-gray-700">
192
+ <i class="fas fa-times"></i>
193
+ </button>
194
+ </div>
195
+ <div id="history-list" class="flex-1 overflow-y-auto custom-scrollbar p-4 space-y-2">
196
+ <!-- History items will be added here -->
197
+ <div class="p-3 bg-blue-50 rounded-lg cursor-pointer hover:bg-blue-100 transition">
198
+ <h4 class="font-medium">New chat started</h4>
199
+ <p class="text-sm text-gray-500 truncate">Hello! I'm DeepSeek AI. How can I assist you today?</p>
200
+ <p class="text-xs text-gray-400 mt-1">Just now</p>
201
+ </div>
202
+ </div>
203
+ <div class="border-t p-4 flex justify-end">
204
+ <button id="clear-history" class="px-4 py-2 text-red-600 hover:bg-red-50 rounded-md">
205
+ Clear History
206
+ </button>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <script>
212
+ document.addEventListener('DOMContentLoaded', function() {
213
+ // Set welcome message time
214
+ const now = new Date();
215
+ document.getElementById('welcome-time').textContent = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
216
+
217
+ // DOM elements
218
+ const messageInput = document.getElementById('message-input');
219
+ const sendBtn = document.getElementById('send-btn');
220
+ const chatContainer = document.getElementById('chat-container');
221
+ const settingsBtn = document.getElementById('settings-btn');
222
+ const historyBtn = document.getElementById('history-btn');
223
+ const settingsModal = document.getElementById('settings-modal');
224
+ const historyModal = document.getElementById('history-modal');
225
+ const closeSettings = document.getElementById('close-settings');
226
+ const closeHistory = document.getElementById('close-history');
227
+ const cancelSettings = document.getElementById('cancel-settings');
228
+ const saveSettings = document.getElementById('save-settings');
229
+ const clearHistory = document.getElementById('clear-history');
230
+ const toggleKey = document.getElementById('toggle-key');
231
+ const temperature = document.getElementById('temperature');
232
+ const tempValue = document.getElementById('temp-value');
233
+
234
+ // Auto-resize textarea
235
+ messageInput.addEventListener('input', function() {
236
+ this.style.height = 'auto';
237
+ this.style.height = (this.scrollHeight) + 'px';
238
+ });
239
+
240
+ // Send message function
241
+ function sendMessage() {
242
+ const message = messageInput.value.trim();
243
+ if (message === '') return;
244
+
245
+ // Add user message to chat
246
+ addMessageToChat('user', message);
247
+
248
+ // Clear input
249
+ messageInput.value = '';
250
+ messageInput.style.height = 'auto';
251
+
252
+ // Show typing indicator
253
+ showTypingIndicator();
254
+
255
+ // Simulate API response after delay
256
+ setTimeout(() => {
257
+ // Hide typing indicator
258
+ hideTypingIndicator();
259
+
260
+ // Simulate API response
261
+ const responses = [
262
+ "I've processed your request. What specific aspect would you like me to focus on?",
263
+ "That's an interesting question! Here's what I can tell you about that topic...",
264
+ "Based on my analysis, I'd recommend considering the following approach...",
265
+ "I've researched this topic and found several relevant points. First...",
266
+ "Let me break this down into more manageable parts to better address your inquiry."
267
+ ];
268
+ const randomResponse = responses[Math.floor(Math.random() * responses.length)];
269
+
270
+ // Add AI response to chat
271
+ addMessageToChat('ai', randomResponse);
272
+ }, 1500 + Math.random() * 2000); // Random delay between 1.5-3.5 seconds
273
+ }
274
+
275
+ // Add message to chat
276
+ function addMessageToChat(sender, message) {
277
+ const now = new Date();
278
+ const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
279
+
280
+ const messageDiv = document.createElement('div');
281
+ messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
282
+
283
+ messageDiv.innerHTML = `
284
+ <div class="max-w-[80%] md:max-w-[70%] bubble-in">
285
+ <div class="${sender === 'user' ? 'bg-blue-600 text-white' : 'bg-white'} p-4 rounded-2xl ${sender === 'user' ? 'rounded-tr-none' : 'rounded-tl-none'} shadow-md">
286
+ ${sender === 'ai' ? `
287
+ <div class="flex items-center space-x-2 mb-2">
288
+ <div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center">
289
+ <i class="fas fa-robot text-purple-600"></i>
290
+ </div>
291
+ <span class="font-semibold ${sender === 'user' ? 'text-white' : 'text-gray-700'}">DeepSeek AI</span>
292
+ </div>
293
+ ` : ''}
294
+ <p class="${sender === 'user' ? 'text-white' : 'text-gray-700'}">${message}</p>
295
+ </div>
296
+ <p class="text-xs text-gray-500 mt-1 ${sender === 'user' ? 'text-right mr-2' : 'ml-2'}">Today at ${timeString}</p>
297
+ </div>
298
+ `;
299
+
300
+ chatContainer.appendChild(messageDiv);
301
+ chatContainer.scrollTop = chatContainer.scrollHeight;
302
+ }
303
+
304
+ // Show typing indicator
305
+ function showTypingIndicator() {
306
+ const typingDiv = document.createElement('div');
307
+ typingDiv.className = 'flex justify-start';
308
+ typingDiv.id = 'typing-indicator';
309
+
310
+ typingDiv.innerHTML = `
311
+ <div class="max-w-[80%] md:max-w-[70%]">
312
+ <div class="bg-white p-4 rounded-2xl rounded-tl-none shadow-md">
313
+ <div class="flex items-center space-x-2 text-gray-500">
314
+ <div class="flex space-x-1 items-center">
315
+ <span class="typing-dot w-2 h-2 bg-gray-400 rounded-full"></span>
316
+ <span class="typing-dot w-2 h-2 bg-gray-400 rounded-full"></span>
317
+ <span class="typing-dot w-2 h-2 bg-gray-400 rounded-full"></span>
318
+ </div>
319
+ <span>DeepSeek AI is typing...</span>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ `;
324
+
325
+ chatContainer.appendChild(typingDiv);
326
+ chatContainer.scrollTop = chatContainer.scrollHeight;
327
+ }
328
+
329
+ // Hide typing indicator
330
+ function hideTypingIndicator() {
331
+ const typingIndicator = document.getElementById('typing-indicator');
332
+ if (typingIndicator) {
333
+ typingIndicator.remove();
334
+ }
335
+ }
336
+
337
+ // Event listeners
338
+ sendBtn.addEventListener('click', sendMessage);
339
+
340
+ messageInput.addEventListener('keydown', function(e) {
341
+ if (e.key === 'Enter' && !e.shiftKey) {
342
+ e.preventDefault();
343
+ sendMessage();
344
+ }
345
+ });
346
+
347
+ // Modal controls
348
+ settingsBtn.addEventListener('click', () => settingsModal.classList.remove('hidden'));
349
+ historyBtn.addEventListener('click', () => historyModal.classList.remove('hidden'));
350
+ closeSettings.addEventListener('click', () => settingsModal.classList.add('hidden'));
351
+ closeHistory.addEventListener('click', () => historyModal.classList.add('hidden'));
352
+ cancelSettings.addEventListener('click', () => settingsModal.classList.add('hidden'));
353
+
354
+ // Temperature slider
355
+ temperature.addEventListener('input', function() {
356
+ tempValue.textContent = this.value;
357
+ });
358
+
359
+ // Toggle API key visibility
360
+ let keyVisible = false;
361
+ toggleKey.addEventListener('click', function() {
362
+ const apiKeyInput = document.getElementById('api-key');
363
+ keyVisible = !keyVisible;
364
+ apiKeyInput.type = keyVisible ? 'text' : 'password';
365
+ this.innerHTML = keyVisible ? '<i class="fas fa-eye-slash"></i>' : '<i class="fas fa-eye"></i>';
366
+ });
367
+
368
+ // Save settings
369
+ saveSettings.addEventListener('click', function() {
370
+ const apiKey = document.getElementById('api-key').value;
371
+ const model = document.getElementById('model-select').value;
372
+ const temp = temperature.value;
373
+
374
+ // In a real app, you would save these to localStorage or send to server
375
+ console.log('Settings saved:', { apiKey, model, temp });
376
+
377
+ // Show success message
378
+ alert('Settings saved successfully!');
379
+ settingsModal.classList.add('hidden');
380
+ });
381
+
382
+ // Clear history
383
+ clearHistory.addEventListener('click', function() {
384
+ if (confirm('Are you sure you want to clear all chat history?')) {
385
+ const historyList = document.getElementById('history-list');
386
+ while (historyList.firstChild) {
387
+ historyList.removeChild(historyList.firstChild);
388
+ }
389
+ historyModal.classList.add('hidden');
390
+ }
391
+ });
392
+
393
+ // Initialize chat with an example if empty
394
+ if (chatContainer.children.length === 1) {
395
+ // Only the welcome message is present
396
+ setTimeout(() => {
397
+ addMessageToChat('ai', "Feel free to ask me anything - technical questions, general knowledge, creative ideas, or help with problem solving. I'm here to help!");
398
+ }, 1000);
399
+ }
400
+ });
401
+
402
+ // Custom animation for modal pop-in
403
+ document.addEventListener('DOMContentLoaded', function() {
404
+ const style = document.createElement('style');
405
+ style.textContent = `
406
+ @keyframes pop-in {
407
+ 0% { opacity: 0; transform: translateY(20px) scale(0.95); }
408
+ 100% { opacity: 1; transform: translateY(0) scale(1); }
409
+ }
410
+ .animate-pop-in {
411
+ animation: pop-in 0.2s ease-out forwards;
412
+ }
413
+ `;
414
+ document.head.appendChild(style);
415
+ });
416
+ </script>
417
+ <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=Sonata71/ai-deepseek" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
418
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ i want to create site web where can i talk with api deepseek