Tingchenliang commited on
Commit
be46bb4
·
verified ·
1 Parent(s): 3ac2337

Upload folder using huggingface_hub

Browse files
assets/css/styles.css ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: 'Tahoma', sans-serif;
9
+ overflow: hidden;
10
+ background: #3a6ea5;
11
+ height: 100vh;
12
+ }
13
+
14
+ .desktop {
15
+ width: 100%;
16
+ height: 100vh;
17
+ background: linear-gradient(to bottom, #3a6ea5 0%, #7db9e8 100%);
18
+ position: relative;
19
+ }
20
+
21
+ .taskbar {
22
+ position: fixed;
23
+ bottom: 0;
24
+ left: 0;
25
+ right: 0;
26
+ height: 30px;
27
+ background: linear-gradient(to bottom, #3d95ff 0%, #0058e6 100%);
28
+ border-top: 1px solid #5ca0ff;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: space-between;
32
+ padding: 0 10px;
33
+ z-index: 1000;
34
+ }
35
+
36
+ .start-button {
37
+ display: flex;
38
+ align-items: center;
39
+ background: linear-gradient(to bottom, #3d95ff 0%, #0058e6 100%);
40
+ border: 1px outset #5ca0ff;
41
+ padding: 2px 8px;
42
+ cursor: pointer;
43
+ font-weight: bold;
44
+ color: white;
45
+ font-size: 11px;
46
+ }
47
+
48
+ .start-button:hover {
49
+ background: linear-gradient(to bottom, #5ca0ff 0%, #0078ff 100%);
50
+ }
51
+
52
+ .start-button:active {
53
+ border: 1px inset #5ca0ff;
54
+ }
55
+
56
+ .start-icon {
57
+ width: 16px;
58
+ height: 16px;
59
+ margin-right: 4px;
60
+ }
61
+
62
+ .taskbar-time {
63
+ color: white;
64
+ font-size: 11px;
65
+ padding: 2px 8px;
66
+ background: linear-gradient(to bottom, #0058e6 0%, #003d9e 100%);
67
+ border: 1px inset #5ca0ff;
68
+ }
69
+
70
+ .desktop-icons {
71
+ position: absolute;
72
+ top: 20px;
73
+ left: 20px;
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: 20px;
77
+ }
78
+
79
+ .desktop-icon {
80
+ display: flex;
81
+ flex-direction: column;
82
+ align-items: center;
83
+ cursor: pointer;
84
+ padding: 5px;
85
+ width: 75px;
86
+ }
87
+
88
+ .desktop-icon:hover {
89
+ background: rgba(255, 255, 255, 0.2);
90
+ border: 1px dotted white;
91
+ }
92
+
93
+ .desktop-icon img {
94
+ width: 32px;
95
+ height: 32px;
96
+ margin-bottom: 5px;
97
+ }
98
+
99
+ .desktop-icon span {
100
+ color: white;
101
+ font-size: 11px;
102
+ text-align: center;
103
+ text-shadow: 1px 1px 1px black;
104
+ }
105
+
106
+ .window {
107
+ position: absolute;
108
+ top: 50px;
109
+ left: 50px;
110
+ width: 600px;
111
+ height: 500px;
112
+ background: #ece9d8;
113
+ border: 2px outset #ece9d8;
114
+ box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
115
+ min-width: 400px;
116
+ min-height: 300px;
117
+ }
118
+
119
+ .window-header {
120
+ background: linear-gradient(to right, #0058e6 0%, #3d95ff 100%);
121
+ color: white;
122
+ padding: 3px 5px;
123
+ display: flex;
124
+ justify-content: space-between;
125
+ align-items: center;
126
+ cursor: move;
127
+ }
128
+
129
+ .window-title {
130
+ font-size: 11px;
131
+ font-weight: bold;
132
+ }
133
+
134
+ .window-controls {
135
+ display: flex;
136
+ gap: 2px;
137
+ }
138
+
139
+ .window-btn {
140
+ width: 16px;
141
+ height: 14px;
142
+ background: #ece9d8;
143
+ border: 1px outset #ece9d8;
144
+ font-size: 10px;
145
+ cursor: pointer;
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ }
150
+
151
+ .window-btn:hover {
152
+ background: #ffffff;
153
+ }
154
+
155
+ .window-btn:active {
156
+ border: 1px inset #ece9d8;
157
+ }
158
+
159
+ .window-content {
160
+ height: calc(100% - 22px);
161
+ padding: 10px;
162
+ }
163
+
164
+ .chat-container {
165
+ display: flex;
166
+ flex-direction: column;
167
+ height: 100%;
168
+ }
169
+
170
+ .chat-messages {
171
+ flex: 1;
172
+ background: white;
173
+ border: 1px inset #ece9d8;
174
+ padding: 10px;
175
+ overflow-y: auto;
176
+ margin-bottom: 10px;
177
+ }
178
+
179
+ .chat-message {
180
+ margin-bottom: 10px;
181
+ padding: 5px;
182
+ border-radius: 3px;
183
+ }
184
+
185
+ .chat-message.user {
186
+ background: #e3f2fd;
187
+ text-align: right;
188
+ }
189
+
190
+ .chat-message.assistant {
191
+ background: #f5f5f5;
192
+ }
193
+
194
+ .chat-message strong {
195
+ font-size: 11px;
196
+ color: #0058e6;
197
+ }
198
+
199
+ .chat-message p {
200
+ font-size: 11px;
201
+ margin-top: 2px;
202
+ }
203
+
204
+ .chat-input-container {
205
+ display: flex;
206
+ gap: 5px;
207
+ }
208
+
209
+ .chat-input {
210
+ flex: 1;
211
+ padding: 3px;
212
+ border: 1px inset #ece9d8;
213
+ font-size: 11px;
214
+ font-family: 'Tahoma', sans-serif;
215
+ }
216
+
217
+ .send-button {
218
+ padding: 3px 15px;
219
+ background: #ece9d8;
220
+ border: 1px outset #ece9d8;
221
+ font-size: 11px;
222
+ cursor: pointer;
223
+ }
224
+
225
+ .send-button:hover {
226
+ background: #ffffff;
227
+ }
228
+
229
+ .send-button:active {
230
+ border: 1px inset #ece9d8;
231
+ }
232
+
233
+ .start-menu {
234
+ position: fixed;
235
+ bottom: 30px;
236
+ left: 0;
237
+ width: 300px;
238
+ background: #ece9d8;
239
+ border: 2px outset #ece9d8;
240
+ box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
241
+ z-index: 1001;
242
+ }
243
+
244
+ .start-menu-header {
245
+ background: linear-gradient(to right, #0058e6 0%, #3d95ff 100%);
246
+ padding: 10px;
247
+ display: flex;
248
+ align-items: center;
249
+ }
250
+
251
+ .user-info {
252
+ display: flex;
253
+ align-items: center;
254
+ color: white;
255
+ font-weight: bold;
256
+ }
257
+
258
+ .user-info img {
259
+ width: 32px;
260
+ height: 32px;
261
+ margin-right: 10px;
262
+ }
263
+
264
+ .start-menu-items {
265
+ padding: 5px;
266
+ }
267
+
268
+ .start-menu-item {
269
+ padding: 5px 10px;
270
+ font-size: 11px;
271
+ cursor: pointer;
272
+ }
273
+
274
+ .start-menu-item:hover {
275
+ background: #316ac5;
276
+ color: white;
277
+ }
278
+
279
+ .start-menu-footer {
280
+ border-top: 1px solid #999;
281
+ padding-top: 5px;
282
+ margin-top: 5px;
283
+ }
284
+
285
+ .built-with {
286
+ position: fixed;
287
+ top: 10px;
288
+ right: 10px;
289
+ background: rgba(0, 0, 0, 0.7);
290
+ padding: 5px 10px;
291
+ border-radius: 3px;
292
+ z-index: 1002;
293
+ }
294
+
295
+ .built-with a {
296
+ color: white;
297
+ text-decoration: none;
298
+ font-size: 11px;
299
+ }
300
+
301
+ .built-with a:hover {
302
+ text-decoration: underline;
303
+ }
304
+
305
+ .loading {
306
+ font-style: italic;
307
+ color: #666;
308
+ }
309
+
310
+ .error {
311
+ color: #d32f2f;
312
+ font-style: italic;
313
+ }
314
+
315
+ @media (max-width: 768px) {
316
+ .window {
317
+ width: 90%;
318
+ height: 70%;
319
+ left: 5%;
320
+ top: 10%;
321
+ }
322
+
323
+ .desktop-icons {
324
+ flex-direction: row;
325
+ flex-wrap: wrap;
326
+ width: calc(100% - 40px);
327
+ }
328
+ }
assets/images/start-icon.png ADDED
assets/js/script.js ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Time update
2
+ function updateTime() {
3
+ const now = new Date();
4
+ const hours = now.getHours();
5
+ const minutes = now.getMinutes();
6
+ const ampm = hours >= 12 ? 'PM' : 'AM';
7
+ const displayHours = hours % 12 || 12;
8
+ const displayMinutes = minutes < 10 ? '0' + minutes : minutes;
9
+ document.getElementById('taskbarTime').textContent = `${displayHours}:${displayMinutes} ${ampm}`;
10
+ }
11
+
12
+ updateTime();
13
+ setInterval(updateTime, 1000);
14
+
15
+ // Start menu toggle
16
+ const startButton = document.querySelector('.start-button');
17
+ const startMenu = document.getElementById('startMenu');
18
+
19
+ startButton.addEventListener('click', (e) => {
20
+ e.stopPropagation();
21
+ startMenu.style.display = startMenu.style.display === 'none' ? 'block' : 'none';
22
+ });
23
+
24
+ document.addEventListener('click', () => {
25
+ startMenu.style.display = 'none';
26
+ });
27
+
28
+ // Desktop icons
29
+ const desktopIcons = document.querySelectorAll('.desktop-icon');
30
+ const aiChatWindow = document.getElementById('aiChatWindow');
31
+
32
+ desktopIcons.forEach(icon => {
33
+ icon.addEventListener('dblclick', () => {
34
+ const app = icon.dataset.app;
35
+ if (app === 'ai-chat') {
36
+ aiChatWindow.style.display = 'block';
37
+ }
38
+ });
39
+ });
40
+
41
+ // Window controls
42
+ const windowControls = document.querySelectorAll('.window-btn');
43
+
44
+ windowControls.forEach(btn => {
45
+ btn.addEventListener('click', (e) => {
46
+ const window = e.target.closest('.window');
47
+ if (e.target.classList.contains('close')) {
48
+ window.style.display = 'none';
49
+ } else if (e.target.classList.contains('minimize')) {
50
+ window.style.display = 'none';
51
+ }
52
+ });
53
+ });
54
+
55
+ // Window dragging
56
+ let isDragging = false;
57
+ let dragOffset = { x: 0, y: 0 };
58
+
59
+ const windowHeader = document.querySelector('.window-header');
60
+
61
+ windowHeader.addEventListener('mousedown', (e) => {
62
+ isDragging = true;
63
+ const rect = aiChatWindow.getBoundingClientRect();
64
+ dragOffset.x = e.clientX - rect.left;
65
+ dragOffset.y = e.clientY - rect.top;
66
+ });
67
+
68
+ document.addEventListener('mousemove', (e) => {
69
+ if (isDragging) {
70
+ aiChatWindow.style.left = (e.clientX - dragOffset.x) + 'px';
71
+ aiChatWindow.style.top = (e.clientY - dragOffset.y) + 'px';
72
+ }
73
+ });
74
+
75
+ document.addEventListener('mouseup', () => {
76
+ isDragging = false;
77
+ });
78
+
79
+ // Chat functionality
80
+ const chatMessages = document.getElementById('chatMessages');
81
+ const chatInput = document.getElementById('chatInput');
82
+ const sendButton = document.getElementById('sendButton');
83
+
84
+ function addMessage(role, content) {
85
+ const messageDiv = document.createElement('div');
86
+ messageDiv.className = `chat-message ${role}`;
87
+ messageDiv.innerHTML = `
88
+ <strong>${role === 'user' ? 'You' : 'AI Assistant'}:</strong>
89
+ <p>${content}</p>
90
+ `;
91
+ chatMessages.appendChild(messageDiv);
92
+ chatMessages.scrollTop = chatMessages.scrollHeight;
93
+ }
94
+
95
+ async function sendMessage() {
96
+ const message = chatInput.value.trim();
97
+ if (!message) return;
98
+
99
+ addMessage('user', message);
100
+ chatInput.value = '';
101
+
102
+ const loadingDiv = document.createElement('div');
103
+ loadingDiv.className = 'chat-message assistant loading';
104
+ loadingDiv.innerHTML = '<strong>AI Assistant:</strong><p>Thinking...</p>';
105
+ chatMessages.appendChild(loadingDiv);
106
+ chatMessages.scrollTop = chatMessages.scrollHeight;
107
+
108
+ try {
109
+ const response = await fetch('https://api.novita.ai/openai/v1/chat/completions', {
110
+ method: 'POST',
111
+ headers: {
112
+ 'Content-Type': 'application/json',
113
+ 'Authorization': 'Bearer sk_IFT2vaiqJ1naH0HU-NS_ixSF3iAo6x_2zkpGEKcLXQM'
114
+ },
115
+ body: JSON.stringify({
116
+ model: 'deepseek/deepseek-v3-0324',
117
+ messages: [
118
+ { role: 'system', content: 'You are a helpful assistant.' },
119
+ { role: 'user', content: message }
120
+ ],
121
+ max_tokens: 1000,
122
+ temperature: 0.7
123
+ })
124
+ });
125
+
126
+ if (!response.ok) {
127
+ throw new Error(`HTTP error! status: ${response.status}`);
128
+ }
129
+
130
+ const data = await response.json();
131
+ const assistantMessage = data.choices[0].message.content;
132
+
133
+ loadingDiv.remove();
134
+ addMessage('assistant', assistantMessage);
135
+ } catch (error) {
136
+ loadingDiv.remove();
137
+ addMessage('assistant', `<span class="error">Error: ${error.message}</span>`);
138
+ }
139
+ }
140
+
141
+ sendButton.addEventListener('click', sendMessage);
142
+ chatInput.addEventListener('keypress', (e) => {
143
+ if (e.key === 'Enter') {
144
+ sendMessage();
145
+ }
146
+ });
index.html CHANGED
@@ -1,19 +1,87 @@
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>Windows XP Desktop - AI Chat</title>
7
+ <meta name="description" content="Windows XP desktop experience with integrated AI chat application">
8
+ <meta name="keywords" content="Windows XP, AI chat, desktop simulation">
9
+ <link rel="stylesheet" href="assets/css/styles.css">
10
+ <link rel="preconnect" href="https://fonts.googleapis.com">
11
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
+ <link href="https://fonts.googleapis.com/css2?family=Tahoma:wght@400;700&display=swap" rel="stylesheet">
13
+ </head>
14
+ <body>
15
+ <div class="desktop">
16
+ <div class="taskbar">
17
+ <div class="start-button">
18
+ <img src="assets/images/start-icon.png" alt="Start" class="start-icon">
19
+ <span>start</span>
20
+ </div>
21
+ <div class="taskbar-time" id="taskbarTime">12:00 PM</div>
22
+ </div>
23
+
24
+ <div class="desktop-icons">
25
+ <div class="desktop-icon" data-app="ai-chat">
26
+ <img src="assets/images/chat-icon.png" alt="AI Chat">
27
+ <span>AI Chat</span>
28
+ </div>
29
+ <div class="desktop-icon" data-app="my-computer">
30
+ <img src="assets/images/computer-icon.png" alt="My Computer">
31
+ <span>My Computer</span>
32
+ </div>
33
+ <div class="desktop-icon" data-app="recycle-bin">
34
+ <img src="assets/images/recycle-icon.png" alt="Recycle Bin">
35
+ <span>Recycle Bin</span>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="window" id="aiChatWindow" style="display: none;">
40
+ <div class="window-header">
41
+ <div class="window-title">AI Chat - Powered by Novita AI</div>
42
+ <div class="window-controls">
43
+ <button class="window-btn minimize">_</button>
44
+ <button class="window-btn maximize">□</button>
45
+ <button class="window-btn close">✕</button>
46
+ </div>
47
+ </div>
48
+ <div class="window-content">
49
+ <div class="chat-container">
50
+ <div class="chat-messages" id="chatMessages"></div>
51
+ <div class="chat-input-container">
52
+ <input type="text" class="chat-input" id="chatInput" placeholder="Type your message here...">
53
+ <button class="send-button" id="sendButton">Send</button>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="start-menu" id="startMenu" style="display: none;">
61
+ <div class="start-menu-header">
62
+ <div class="user-info">
63
+ <img src="assets/images/user-icon.png" alt="User">
64
+ <span>User</span>
65
+ </div>
66
+ </div>
67
+ <div class="start-menu-items">
68
+ <div class="start-menu-item">Programs</div>
69
+ <div class="start-menu-item">Documents</div>
70
+ <div class="start-menu-item">Settings</div>
71
+ <div class="start-menu-item">Search</div>
72
+ <div class="start-menu-item">Help</div>
73
+ <div class="start-menu-item">Run...</div>
74
+ </div>
75
+ <div class="start-menu-footer">
76
+ <div class="start-menu-item">Log Off</div>
77
+ <div class="start-menu-item">Turn Off Computer</div>
78
+ </div>
79
+ </div>
80
+
81
+ <div class="built-with">
82
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
83
+ </div>
84
+
85
+ <script src="assets/js/script.js"></script>
86
+ </body>
87
+ </html>