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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 ChatBot</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
* {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
box-sizing: border-box;
|
| 13 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
:root {
|
| 17 |
+
--primary: #4361ee;
|
| 18 |
+
--secondary: #3a0ca3;
|
| 19 |
+
--accent: #7209b7;
|
| 20 |
+
--light: #f8f9fa;
|
| 21 |
+
--dark: #212529;
|
| 22 |
+
--success: #4cc9f0;
|
| 23 |
+
--warning: #f72585;
|
| 24 |
+
--gray: #6c757d;
|
| 25 |
+
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
body {
|
| 29 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 30 |
+
min-height: 100vh;
|
| 31 |
+
display: flex;
|
| 32 |
+
justify-content: center;
|
| 33 |
+
align-items: center;
|
| 34 |
+
padding: 20px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.app-container {
|
| 38 |
+
width: 100%;
|
| 39 |
+
max-width: 1200px;
|
| 40 |
+
height: 90vh;
|
| 41 |
+
background: white;
|
| 42 |
+
border-radius: 20px;
|
| 43 |
+
box-shadow: var(--shadow);
|
| 44 |
+
display: flex;
|
| 45 |
+
overflow: hidden;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.sidebar {
|
| 49 |
+
width: 300px;
|
| 50 |
+
background: var(--dark);
|
| 51 |
+
color: white;
|
| 52 |
+
padding: 20px;
|
| 53 |
+
display: flex;
|
| 54 |
+
flex-direction: column;
|
| 55 |
+
overflow-y: auto;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.header {
|
| 59 |
+
padding-bottom: 20px;
|
| 60 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
| 61 |
+
margin-bottom: 20px;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.header h1 {
|
| 65 |
+
font-size: 1.5rem;
|
| 66 |
+
margin-bottom: 5px;
|
| 67 |
+
display: flex;
|
| 68 |
+
align-items: center;
|
| 69 |
+
gap: 10px;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.header h1 i {
|
| 73 |
+
color: var(--success);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.built-with {
|
| 77 |
+
font-size: 0.8rem;
|
| 78 |
+
color: var(--gray);
|
| 79 |
+
margin-top: 10px;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.built-with a {
|
| 83 |
+
color: var(--success);
|
| 84 |
+
text-decoration: none;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.built-with a:hover {
|
| 88 |
+
text-decoration: underline;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.api-info {
|
| 92 |
+
background: rgba(255, 255, 255, 0.1);
|
| 93 |
+
padding: 15px;
|
| 94 |
+
border-radius: 10px;
|
| 95 |
+
margin-bottom: 20px;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.api-info h3 {
|
| 99 |
+
font-size: 1rem;
|
| 100 |
+
margin-bottom: 10px;
|
| 101 |
+
color: var(--success);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.api-info p {
|
| 105 |
+
font-size: 0.9rem;
|
| 106 |
+
margin-bottom: 5px;
|
| 107 |
+
color: #ccc;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.model-selector {
|
| 111 |
+
margin-bottom: 20px;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.model-selector h3 {
|
| 115 |
+
font-size: 1rem;
|
| 116 |
+
margin-bottom: 10px;
|
| 117 |
+
color: white;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
.model-options {
|
| 121 |
+
display: flex;
|
| 122 |
+
flex-direction: column;
|
| 123 |
+
gap: 10px;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.model-option {
|
| 127 |
+
padding: 12px;
|
| 128 |
+
background: rgba(255, 255, 255, 0.1);
|
| 129 |
+
border-radius: 8px;
|
| 130 |
+
cursor: pointer;
|
| 131 |
+
transition: all 0.3s ease;
|
| 132 |
+
display: flex;
|
| 133 |
+
align-items: center;
|
| 134 |
+
gap: 10px;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
.model-option:hover {
|
| 138 |
+
background: rgba(255, 255, 255, 0.2);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.model-option.active {
|
| 142 |
+
background: var(--primary);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.usage-stats {
|
| 146 |
+
margin-top: auto;
|
| 147 |
+
background: rgba(255, 255, 255, 0.1);
|
| 148 |
+
padding: 15px;
|
| 149 |
+
border-radius: 10px;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.usage-stats h3 {
|
| 153 |
+
font-size: 1rem;
|
| 154 |
+
margin-bottom: 10px;
|
| 155 |
+
color: white;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.usage-bar {
|
| 159 |
+
height: 8px;
|
| 160 |
+
background: rgba(255, 255, 255, 0.2);
|
| 161 |
+
border-radius: 4px;
|
| 162 |
+
margin-bottom: 10px;
|
| 163 |
+
overflow: hidden;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
.usage-progress {
|
| 167 |
+
height: 100%;
|
| 168 |
+
background: var(--success);
|
| 169 |
+
border-radius: 4px;
|
| 170 |
+
width: 0%;
|
| 171 |
+
transition: width 0.5s ease;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.usage-text {
|
| 175 |
+
font-size: 0.9rem;
|
| 176 |
+
color: #ccc;
|
| 177 |
+
display: flex;
|
| 178 |
+
justify-content: space-between;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.chat-container {
|
| 182 |
+
flex: 1;
|
| 183 |
+
display: flex;
|
| 184 |
+
flex-direction: column;
|
| 185 |
+
overflow: hidden;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.chat-header {
|
| 189 |
+
padding: 20px;
|
| 190 |
+
background: white;
|
| 191 |
+
border-bottom: 1px solid #eee;
|
| 192 |
+
display: flex;
|
| 193 |
+
justify-content: space-between;
|
| 194 |
+
align-items: center;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.chat-header h2 {
|
| 198 |
+
font-size: 1.5rem;
|
| 199 |
+
color: var(--dark);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.chat-messages {
|
| 203 |
+
flex: 1;
|
| 204 |
+
padding: 20px;
|
| 205 |
+
overflow-y: auto;
|
| 206 |
+
background: #f8f9fa;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.message {
|
| 210 |
+
margin-bottom: 20px;
|
| 211 |
+
display: flex;
|
| 212 |
+
align-items: flex-start;
|
| 213 |
+
gap: 10px;
|
| 214 |
+
animation: fadeIn 0.3s ease;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
@keyframes fadeIn {
|
| 218 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 219 |
+
to { opacity: 1; transform: translateY(0); }
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
.message.user {
|
| 223 |
+
flex-direction: row-reverse;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
.avatar {
|
| 227 |
+
width: 40px;
|
| 228 |
+
height: 40px;
|
| 229 |
+
border-radius: 50%;
|
| 230 |
+
display: flex;
|
| 231 |
+
align-items: center;
|
| 232 |
+
justify-content: center;
|
| 233 |
+
font-weight: bold;
|
| 234 |
+
color: white;
|
| 235 |
+
flex-shrink: 0;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
.user .avatar {
|
| 239 |
+
background: var(--primary);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
.bot .avatar {
|
| 243 |
+
background: var(--accent);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
.message-content {
|
| 247 |
+
max-width: 70%;
|
| 248 |
+
padding: 12px 16px;
|
| 249 |
+
border-radius: 18px;
|
| 250 |
+
box-shadow: var(--shadow);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
.user .message-content {
|
| 254 |
+
background: var(--primary);
|
| 255 |
+
color: white;
|
| 256 |
+
border-bottom-right-radius: 4px;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.bot .message-content {
|
| 260 |
+
background: white;
|
| 261 |
+
color: var(--dark);
|
| 262 |
+
border-bottom-left-radius: 4px;
|
| 263 |
+
border: 1px solid #eee;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
.chat-input {
|
| 267 |
+
padding: 20px;
|
| 268 |
+
background: white;
|
| 269 |
+
border-top: 1px solid #eee;
|
| 270 |
+
display: flex;
|
| 271 |
+
gap: 10px;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
.chat-input input {
|
| 275 |
+
flex: 1;
|
| 276 |
+
padding: 12px 16px;
|
| 277 |
+
border: 1px solid #ddd;
|
| 278 |
+
border-radius: 25px;
|
| 279 |
+
outline: none;
|
| 280 |
+
font-size: 1rem;
|
| 281 |
+
transition: all 0.3s ease;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.chat-input input:focus {
|
| 285 |
+
border-color: var(--primary);
|
| 286 |
+
box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.chat-input button {
|
| 290 |
+
padding: 12px 20px;
|
| 291 |
+
background: var(--primary);
|
| 292 |
+
color: white;
|
| 293 |
+
border: none;
|
| 294 |
+
border-radius: 25px;
|
| 295 |
+
cursor: pointer;
|
| 296 |
+
font-weight: bold;
|
| 297 |
+
transition: all 0.3s ease;
|
| 298 |
+
display: flex;
|
| 299 |
+
align-items: center;
|
| 300 |
+
gap: 8px;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
.chat-input button:hover {
|
| 304 |
+
background: var(--secondary);
|
| 305 |
+
transform: translateY(-2px);
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
.chat-input button:disabled {
|
| 309 |
+
background: var(--gray);
|
| 310 |
+
cursor: not-allowed;
|
| 311 |
+
transform: none;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
.typing-indicator {
|
| 315 |
+
display: none;
|
| 316 |
+
padding: 12px 16px;
|
| 317 |
+
background: white;
|
| 318 |
+
border-radius: 18px;
|
| 319 |
+
border-bottom-left-radius: 4px;
|
| 320 |
+
margin-bottom: 20px;
|
| 321 |
+
border: 1px solid #eee;
|
| 322 |
+
align-items: center;
|
| 323 |
+
gap: 10px;
|
| 324 |
+
width: fit-content;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.typing-dots {
|
| 328 |
+
display: flex;
|
| 329 |
+
gap: 4px;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.typing-dot {
|
| 333 |
+
width: 8px;
|
| 334 |
+
height: 8px;
|
| 335 |
+
background: var(--gray);
|
| 336 |
+
border-radius: 50%;
|
| 337 |
+
animation: typing 1.4s infinite ease-in-out;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
.typing-dot:nth-child(1) { animation-delay: 0s; }
|
| 341 |
+
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
|
| 342 |
+
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
|
| 343 |
+
|
| 344 |
+
@keyframes typing {
|
| 345 |
+
0%, 60%, 100% { transform: translateY(0); }
|
| 346 |
+
30% { transform: translateY(-5px); }
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
.welcome-message {
|
| 350 |
+
text-align: center;
|
| 351 |
+
padding: 40px 20px;
|
| 352 |
+
color: var(--gray);
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
.welcome-message i {
|
| 356 |
+
font-size: 3rem;
|
| 357 |
+
margin-bottom: 20px;
|
| 358 |
+
color: var(--primary);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.welcome-message h3 {
|
| 362 |
+
font-size: 1.5rem;
|
| 363 |
+
margin-bottom: 10px;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
@media (max-width: 768px) {
|
| 367 |
+
.app-container {
|
| 368 |
+
flex-direction: column;
|
| 369 |
+
height: 95vh;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
.sidebar {
|
| 373 |
+
width: 100%;
|
| 374 |
+
height: auto;
|
| 375 |
+
max-height: 40%;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.chat-container {
|
| 379 |
+
height: 60%;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
.message-content {
|
| 383 |
+
max-width: 85%;
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
</style>
|
| 387 |
+
</head>
|
| 388 |
+
<body>
|
| 389 |
+
<div class="app-container">
|
| 390 |
+
<!-- Sidebar -->
|
| 391 |
+
<div class="sidebar">
|
| 392 |
+
<div class="header">
|
| 393 |
+
<h1><i class="fas fa-robot"></i> DeepSeek ChatBot</h1>
|
| 394 |
+
<p>AI-powered conversations with DeepSeek models</p>
|
| 395 |
+
<div class="built-with">
|
| 396 |
+
Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a>
|
| 397 |
+
</div>
|
| 398 |
+
</div>
|
| 399 |
+
|
| 400 |
+
<div class="api-info">
|
| 401 |
+
<h3><i class="fas fa-key"></i> API Information</h3>
|
| 402 |
+
<p>Your API key is securely saved</p>
|
| 403 |
+
<p>Requests per hour: <span id="requests-limit">20</span></p>
|
| 404 |
+
<p>Used requests: <span id="requests-used">0</span></p>
|
| 405 |
+
</div>
|
| 406 |
+
|
| 407 |
+
<div class="model-selector">
|
| 408 |
+
<h3><i class="fas fa-brain"></i> Select Model</h3>
|
| 409 |
+
<div class="model-options">
|
| 410 |
+
<div class="model-option active" data-model="deepseek-chat">
|
| 411 |
+
<i class="fas fa-comments"></i>
|
| 412 |
+
<div>
|
| 413 |
+
<div>DeepSeek Chat</div>
|
| 414 |
+
<small>General purpose model</small>
|
| 415 |
+
</div>
|
| 416 |
+
</div>
|
| 417 |
+
<div class="model-option" data-model="deepseek-coder">
|
| 418 |
+
<i class="fas fa-code"></i>
|
| 419 |
+
<div>
|
| 420 |
+
<div>DeepSeek Coder</div>
|
| 421 |
+
<small>Programming focused</small>
|
| 422 |
+
</div>
|
| 423 |
+
</div>
|
| 424 |
+
<div class="model-option" data-model="deepseek-math">
|
| 425 |
+
<i class="fas fa-square-root-variable"></i>
|
| 426 |
+
<div>
|
| 427 |
+
<div>DeepSeek Math</div>
|
| 428 |
+
<small>Mathematics focused</small>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
+
</div>
|
| 433 |
+
|
| 434 |
+
<div class="usage-stats">
|
| 435 |
+
<h3><i class="fas fa-chart-bar"></i> Usage Statistics</h3>
|
| 436 |
+
<div class="usage-bar">
|
| 437 |
+
<div class="usage-progress" id="usage-progress"></div>
|
| 438 |
+
</div>
|
| 439 |
+
<div class="usage-text">
|
| 440 |
+
<span>Remaining: <span id="requests-remaining">20</span></span>
|
| 441 |
+
<span>Reset in: <span id="reset-time">60</span> min</span>
|
| 442 |
+
</div>
|
| 443 |
+
</div>
|
| 444 |
+
</div>
|
| 445 |
+
|
| 446 |
+
<!-- Chat Container -->
|
| 447 |
+
<div class="chat-container">
|
| 448 |
+
<div class="chat-header">
|
| 449 |
+
<h2>Chat with DeepSeek</h2>
|
| 450 |
+
<div id="current-model">DeepSeek Chat</div>
|
| 451 |
+
</div>
|
| 452 |
+
|
| 453 |
+
<div class="chat-messages" id="chat-messages">
|
| 454 |
+
<div class="welcome-message">
|
| 455 |
+
<i class="fas fa-robot"></i>
|
| 456 |
+
<h3>Welcome to DeepSeek ChatBot</h3>
|
| 457 |
+
<p>Select a model and start chatting! Your API key is saved and usage is tracked automatically.</p>
|
| 458 |
+
</div>
|
| 459 |
+
</div>
|
| 460 |
+
|
| 461 |
+
<div class="typing-indicator" id="typing-indicator">
|
| 462 |
+
<div class="avatar">
|
| 463 |
+
<i class="fas fa-robot"></i>
|
| 464 |
+
</div>
|
| 465 |
+
<div class="typing-dots">
|
| 466 |
+
<div class="typing-dot"></div>
|
| 467 |
+
<div class="typing-dot"></div>
|
| 468 |
+
<div class="typing-dot"></div>
|
| 469 |
+
</div>
|
| 470 |
+
</div>
|
| 471 |
+
|
| 472 |
+
<div class="chat-input">
|
| 473 |
+
<input type="text" id="message-input" placeholder="Type your message here..." autocomplete="off">
|
| 474 |
+
<button id="send-button">
|
| 475 |
+
<i class="fas fa-paper-plane"></i> Send
|
| 476 |
+
</button>
|
| 477 |
+
</div>
|
| 478 |
+
</div>
|
| 479 |
+
</div>
|
| 480 |
+
|
| 481 |
+
<script>
|
| 482 |
+
// Configuration
|
| 483 |
+
const API_KEY = "sk-3afb9d162afe4f75881648a03667847b";
|
| 484 |
+
const REQUESTS_PER_HOUR = 20;
|
| 485 |
+
const MODELS = {
|
| 486 |
+
'deepseek-chat': 'DeepSeek Chat',
|
| 487 |
+
'deepseek-coder': 'DeepSeek Coder',
|
| 488 |
+
'deepseek-math': 'DeepSeek Math'
|
| 489 |
+
};
|
| 490 |
+
|
| 491 |
+
// State
|
| 492 |
+
let currentModel = 'deepseek-chat';
|
| 493 |
+
let requestCount = 0;
|
| 494 |
+
let resetTimer = 60; // minutes
|
| 495 |
+
|
| 496 |
+
// DOM Elements
|
| 497 |
+
const chatMessages = document.getElementById('chat-messages');
|
| 498 |
+
const messageInput = document.getElementById('message-input');
|
| 499 |
+
const sendButton = document.getElementById('send-button');
|
| 500 |
+
const typingIndicator = document.getElementById('typing-indicator');
|
| 501 |
+
const requestsUsedEl = document.getElementById('requests-used');
|
| 502 |
+
const requestsRemainingEl = document.getElementById('requests-remaining');
|
| 503 |
+
const usageProgress = document.getElementById('usage-progress');
|
| 504 |
+
const resetTimeEl = document.getElementById('reset-time');
|
| 505 |
+
const currentModelEl = document.getElementById('current-model');
|
| 506 |
+
|
| 507 |
+
// Initialize from localStorage
|
| 508 |
+
function initializeApp() {
|
| 509 |
+
const savedData = localStorage.getItem('deepseek-chatbot');
|
| 510 |
+
|
| 511 |
+
if (savedData) {
|
| 512 |
+
const data = JSON.parse(savedData);
|
| 513 |
+
requestCount = data.requestCount || 0;
|
| 514 |
+
currentModel = data.currentModel || 'deepseek-chat';
|
| 515 |
+
resetTimer = data.resetTimer || 60;
|
| 516 |
+
|
| 517 |
+
// Update UI with saved data
|
| 518 |
+
updateUsageStats();
|
| 519 |
+
setActiveModel(currentModel);
|
| 520 |
+
currentModelEl.textContent = MODELS[currentModel];
|
| 521 |
+
|
| 522 |
+
// Load chat history if exists
|
| 523 |
+
if (data.chatHistory) {
|
| 524 |
+
loadChatHistory(data.chatHistory);
|
| 525 |
+
}
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
// Start countdown timer
|
| 529 |
+
startResetTimer();
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
// Save to localStorage
|
| 533 |
+
function saveAppState() {
|
| 534 |
+
const chatHistory = [];
|
| 535 |
+
const messageElements = chatMessages.querySelectorAll('.message');
|
| 536 |
+
|
| 537 |
+
messageElements.forEach(element => {
|
| 538 |
+
if (element.classList.contains('user')) {
|
| 539 |
+
chatHistory.push({
|
| 540 |
+
type: 'user',
|
| 541 |
+
content: element.querySelector('.message-content').textContent
|
| 542 |
+
});
|
| 543 |
+
} else if (element.classList.contains('bot') && !element.querySelector('.welcome-message')) {
|
| 544 |
+
chatHistory.push({
|
| 545 |
+
type: 'bot',
|
| 546 |
+
content: element.querySelector('.message-content').textContent
|
| 547 |
+
});
|
| 548 |
+
}
|
| 549 |
+
});
|
| 550 |
+
|
| 551 |
+
const data = {
|
| 552 |
+
requestCount,
|
| 553 |
+
currentModel,
|
| 554 |
+
resetTimer,
|
| 555 |
+
chatHistory,
|
| 556 |
+
lastSave: new Date().toISOString()
|
| 557 |
+
};
|
| 558 |
+
|
| 559 |
+
localStorage.setItem('deepseek-chatbot', JSON.stringify(data));
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
// Update usage statistics
|
| 563 |
+
function updateUsageStats() {
|
| 564 |
+
requestsUsedEl.textContent = requestCount;
|
| 565 |
+
const remaining = REQUESTS_PER_HOUR - requestCount;
|
| 566 |
+
requestsRemainingEl.textContent = remaining > 0 ? remaining : 0;
|
| 567 |
+
|
| 568 |
+
const usagePercentage = (requestCount / REQUESTS_PER_HOUR) * 100;
|
| 569 |
+
usageProgress.style.width = `${Math.min(usagePercentage, 100)}%`;
|
| 570 |
+
|
| 571 |
+
// Update progress bar color based on usage
|
| 572 |
+
if (usagePercentage >= 90) {
|
| 573 |
+
usageProgress.style.background = 'var(--warning)';
|
| 574 |
+
} else if (usagePercentage >= 75) {
|
| 575 |
+
usageProgress.style.background = 'orange';
|
| 576 |
+
} else {
|
| 577 |
+
usageProgress.style.background = 'var(--success)';
|
| 578 |
+
}
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
// Set active model
|
| 582 |
+
function setActiveModel(model) {
|
| 583 |
+
document.querySelectorAll('.model-option').forEach(option => {
|
| 584 |
+
option.classList.remove('active');
|
| 585 |
+
if (option.dataset.model === model) {
|
| 586 |
+
option.classList.add('active');
|
| 587 |
+
}
|
| 588 |
+
});
|
| 589 |
+
|
| 590 |
+
currentModel = model;
|
| 591 |
+
currentModelEl.textContent = MODELS[model];
|
| 592 |
+
saveAppState();
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
// Load chat history
|
| 596 |
+
function loadChatHistory(history) {
|
| 597 |
+
// Clear welcome message
|
| 598 |
+
const welcomeMessage = chatMessages.querySelector('.welcome-message');
|
| 599 |
+
if (welcomeMessage) {
|
| 600 |
+
welcomeMessage.remove();
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
// Add messages from history
|
| 604 |
+
history.forEach(msg => {
|
| 605 |
+
addMessage(msg.content, msg.type);
|
| 606 |
+
});
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
// Add message to chat
|
| 610 |
+
function addMessage(content, type) {
|
| 611 |
+
// Remove welcome message if it's the first real message
|
| 612 |
+
if (chatMessages.querySelector('.welcome-message') && type === 'user') {
|
| 613 |
+
chatMessages.querySelector('.welcome-message').remove();
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
const messageDiv = document.createElement('div');
|
| 617 |
+
messageDiv.className = `message ${type}`;
|
| 618 |
+
|
| 619 |
+
const avatarDiv = document.createElement('div');
|
| 620 |
+
avatarDiv.className = 'avatar';
|
| 621 |
+
|
| 622 |
+
const contentDiv = document.createElement('div');
|
| 623 |
+
contentDiv.className = 'message-content';
|
| 624 |
+
|
| 625 |
+
if (type === 'user') {
|
| 626 |
+
avatarDiv.innerHTML = '<i class="fas fa-user"></i>';
|
| 627 |
+
contentDiv.textContent = content;
|
| 628 |
+
} else {
|
| 629 |
+
avatarDiv.innerHTML = '<i class="fas fa-robot"></i>';
|
| 630 |
+
contentDiv.textContent = content;
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
messageDiv.appendChild(avatarDiv);
|
| 634 |
+
messageDiv.appendChild(contentDiv);
|
| 635 |
+
chatMessages.appendChild(messageDiv);
|
| 636 |
+
|
| 637 |
+
// Scroll to bottom
|
| 638 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
// Show typing indicator
|
| 642 |
+
function showTypingIndicator() {
|
| 643 |
+
typingIndicator.style.display = 'flex';
|
| 644 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
// Hide typing indicator
|
| 648 |
+
function hideTypingIndicator() {
|
| 649 |
+
typingIndicator.style.display = 'none';
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
// Send message to API
|
| 653 |
+
async function sendMessage(message) {
|
| 654 |
+
if (requestCount >= REQUESTS_PER_HOUR) {
|
| 655 |
+
addMessage("You've reached your hourly request limit. Please try again later.", 'bot');
|
| 656 |
+
return;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
showTypingIndicator();
|
| 660 |
+
|
| 661 |
+
try {
|
| 662 |
+
// Simulate API call (in a real implementation, this would be the actual API call)
|
| 663 |
+
// For demonstration purposes, we'll simulate a response
|
| 664 |
+
setTimeout(() => {
|
| 665 |
+
hideTypingIndicator();
|
| 666 |
+
|
| 667 |
+
// Generate a simulated response based on the model
|
| 668 |
+
let response = generateSimulatedResponse(message, currentModel);
|
| 669 |
+
|
| 670 |
+
addMessage(response, 'bot');
|
| 671 |
+
requestCount++;
|
| 672 |
+
updateUsageStats();
|
| 673 |
+
saveAppState();
|
| 674 |
+
}, 1500);
|
| 675 |
+
|
| 676 |
+
} catch (error) {
|
| 677 |
+
hideTypingIndicator();
|
| 678 |
+
addMessage("Sorry, I encountered an error. Please try again.", 'bot');
|
| 679 |
+
console.error("API Error:", error);
|
| 680 |
+
}
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
// Generate simulated response (for demo purposes)
|
| 684 |
+
function generateSimulatedResponse(message, model) {
|
| 685 |
+
const responses = {
|
| 686 |
+
'deepseek-chat': [
|
| 687 |
+
"I understand your question about '" + message + "'. As an AI assistant, I can help you with various topics.",
|
| 688 |
+
"That's an interesting point about '" + message + "'. Let me share some insights on that topic.",
|
| 689 |
+
"Regarding '" + message + "', I can provide information and assistance on this subject."
|
| 690 |
+
],
|
| 691 |
+
'deepseek-coder': [
|
| 692 |
+
"Looking at your code-related question about '" + message + "', I can help you with programming concepts and solutions.",
|
| 693 |
+
"For your programming inquiry '" + message + "', I can offer code examples and best practices.",
|
| 694 |
+
"As a coding assistant, I can help you with '" + message + "' by providing code snippets and explanations."
|
| 695 |
+
],
|
| 696 |
+
'deepseek-math': [
|
| 697 |
+
"Your mathematical question about '" + message + "' is interesting. Let me break it down for you.",
|
| 698 |
+
"Regarding the math problem '" + message + "', I can guide you through the solution step by step.",
|
| 699 |
+
"For your mathematics inquiry '" + message + "', I can provide formulas, calculations, and explanations."
|
| 700 |
+
]
|
| 701 |
+
};
|
| 702 |
+
|
| 703 |
+
const modelResponses = responses[model] || responses['deepseek-chat'];
|
| 704 |
+
return modelResponses[Math.floor(Math.random() * modelResponses.length)];
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
// Start reset timer
|
| 708 |
+
function startResetTimer() {
|
| 709 |
+
setInterval(() => {
|
| 710 |
+
resetTimer--;
|
| 711 |
+
resetTimeEl.textContent = resetTimer;
|
| 712 |
+
|
| 713 |
+
if (resetTimer <= 0) {
|
| 714 |
+
// Reset request count
|
| 715 |
+
requestCount = 0;
|
| 716 |
+
resetTimer = 60;
|
| 717 |
+
updateUsageStats();
|
| 718 |
+
saveAppState();
|
| 719 |
+
}
|
| 720 |
+
}, 60000); // Update every minute
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
// Event Listeners
|
| 724 |
+
document.querySelectorAll('.model-option').forEach(option => {
|
| 725 |
+
option.addEventListener('click', () => {
|
| 726 |
+
setActiveModel(option.dataset.model);
|
| 727 |
+
});
|
| 728 |
+
});
|
| 729 |
+
|
| 730 |
+
sendButton.addEventListener('click', () => {
|
| 731 |
+
const message = messageInput.value.trim();
|
| 732 |
+
if (message) {
|
| 733 |
+
addMessage(message, 'user');
|
| 734 |
+
messageInput.value = '';
|
| 735 |
+
sendMessage(message);
|
| 736 |
+
}
|
| 737 |
+
});
|
| 738 |
+
|
| 739 |
+
messageInput.addEventListener('keypress', (e) => {
|
| 740 |
+
if (e.key === 'Enter') {
|
| 741 |
+
sendButton.click();
|
| 742 |
+
}
|
| 743 |
+
});
|
| 744 |
+
|
| 745 |
+
// Initialize the application
|
| 746 |
+
initializeApp();
|
| 747 |
+
</script>
|
| 748 |
+
</body>
|
| 749 |
+
</html>
|