Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +584 -560
templates/index.html
CHANGED
|
@@ -1,565 +1,589 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
<div class="typing-indicator" id="typing-indicator" style="display: none;">
|
| 367 |
-
<div class="typing-dots">
|
| 368 |
-
<div class="typing-dot"></div>
|
| 369 |
-
<div class="typing-dot"></div>
|
| 370 |
-
<div class="typing-dot"></div>
|
| 371 |
-
</div>
|
| 372 |
-
<span>Agent is typing...</span>
|
| 373 |
-
</div>
|
| 374 |
-
|
| 375 |
-
<div class="input-container">
|
| 376 |
-
<div class="input-wrapper">
|
| 377 |
-
<textarea id="prompt" rows="1" placeholder="Message Agent..." autofocus></textarea>
|
| 378 |
-
<div class="input-actions">
|
| 379 |
-
<button class="btn-icon" id="upload-btn" title="Upload Database">
|
| 380 |
-
<i class="fas fa-database"></i>
|
| 381 |
</button>
|
| 382 |
-
|
| 383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
</button>
|
| 385 |
</div>
|
|
|
|
|
|
|
|
|
|
| 386 |
</div>
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
}
|
| 563 |
-
</script>
|
| 564 |
-
</body>
|
| 565 |
-
</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">
|
| 6 |
+
<title>Agent Chat</title>
|
| 7 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.4/socket.io.js"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary: #10a37f;
|
| 12 |
+
--primary-dark: #0d8a6a;
|
| 13 |
+
--bg-color: #343541;
|
| 14 |
+
--chat-bg: #444654;
|
| 15 |
+
--user-bg: #343541;
|
| 16 |
+
--text-color: #ececf1;
|
| 17 |
+
--text-secondary: #acacbe;
|
| 18 |
+
--border-color: #565869;
|
| 19 |
+
--log-bg: #2a2b32;
|
| 20 |
+
--error-color: #ef4146;
|
| 21 |
+
--warning-color: #f0b72f;
|
| 22 |
+
--panel-width: 300px; /* Define panel width */
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
* {
|
| 26 |
+
box-sizing: border-box;
|
| 27 |
+
margin: 0;
|
| 28 |
+
padding: 0;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
body {
|
| 32 |
+
background-color: var(--bg-color);
|
| 33 |
+
color: var(--text-color);
|
| 34 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 35 |
+
display: flex;
|
| 36 |
+
flex-direction: column;
|
| 37 |
+
height: 100vh;
|
| 38 |
+
overflow: hidden;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
nav {
|
| 42 |
+
background-color: var(--user-bg);
|
| 43 |
+
padding: 12px 20px;
|
| 44 |
+
border-bottom: 1px solid var(--border-color);
|
| 45 |
+
display: flex;
|
| 46 |
+
justify-content: space-between;
|
| 47 |
+
align-items: center;
|
| 48 |
+
flex-shrink: 0; /* Prevent nav from shrinking */
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.nav-title {
|
| 52 |
+
font-size: 1.2rem;
|
| 53 |
+
font-weight: 600;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.nav-actions {
|
| 57 |
+
display: flex;
|
| 58 |
+
gap: 10px;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.btn {
|
| 62 |
+
background-color: var(--primary);
|
| 63 |
+
color: white;
|
| 64 |
+
border: none;
|
| 65 |
+
border-radius: 4px;
|
| 66 |
+
padding: 8px 12px;
|
| 67 |
+
font-size: 0.9rem;
|
| 68 |
+
cursor: pointer;
|
| 69 |
+
display: flex;
|
| 70 |
+
align-items: center;
|
| 71 |
+
gap: 6px;
|
| 72 |
+
transition: background-color 0.2s;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.btn:hover {
|
| 76 |
+
background-color: var(--primary-dark);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.btn-sm {
|
| 80 |
+
padding: 6px 10px;
|
| 81 |
+
font-size: 0.8rem;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
.btn-icon {
|
| 85 |
+
padding: 8px;
|
| 86 |
+
border-radius: 4px;
|
| 87 |
+
background: transparent;
|
| 88 |
+
color: var(--text-color);
|
| 89 |
+
border: none; /* Ensure no default button border */
|
| 90 |
+
cursor: pointer;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.btn-icon:hover {
|
| 94 |
+
background-color: rgba(255,255,255,0.1);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
main {
|
| 98 |
+
flex: 1;
|
| 99 |
+
display: flex;
|
| 100 |
+
flex-direction: column;
|
| 101 |
+
overflow: hidden;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.chat-container {
|
| 105 |
+
flex: 1;
|
| 106 |
+
overflow-y: auto;
|
| 107 |
+
padding: 20px 0;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.message {
|
| 111 |
+
padding: 20px;
|
| 112 |
+
display: flex;
|
| 113 |
+
max-width: 900px;
|
| 114 |
+
margin: 0 auto;
|
| 115 |
+
gap: 20px;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.message-user {
|
| 119 |
+
background-color: var(--user-bg);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.message-agent {
|
| 123 |
+
background-color: var(--chat-bg);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.avatar {
|
| 127 |
+
width: 36px;
|
| 128 |
+
height: 36px;
|
| 129 |
+
border-radius: 4px;
|
| 130 |
+
display: flex;
|
| 131 |
+
align-items: center;
|
| 132 |
+
justify-content: center;
|
| 133 |
+
flex-shrink: 0;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.avatar-user {
|
| 137 |
+
background-color: var(--primary);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.avatar-agent {
|
| 141 |
+
background-color: #5436da;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
.message-content {
|
| 145 |
+
flex: 1;
|
| 146 |
+
line-height: 1.5;
|
| 147 |
+
padding-top: 4px;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.input-container {
|
| 151 |
+
padding: 20px;
|
| 152 |
+
border-top: 1px solid var(--border-color);
|
| 153 |
+
background-color: var(--user-bg);
|
| 154 |
+
position: relative;
|
| 155 |
+
flex-shrink: 0; /* Prevent input area from shrinking */
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.input-wrapper {
|
| 159 |
+
max-width: 900px;
|
| 160 |
+
margin: 0 auto;
|
| 161 |
+
position: relative;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.input-actions {
|
| 165 |
+
position: absolute;
|
| 166 |
+
right: 12px;
|
| 167 |
+
bottom: 12px;
|
| 168 |
+
display: flex;
|
| 169 |
+
gap: 8px;
|
| 170 |
+
z-index: 2;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
textarea {
|
| 174 |
+
width: 100%;
|
| 175 |
+
min-height: 60px;
|
| 176 |
+
max-height: 200px;
|
| 177 |
+
padding: 12px 50px 12px 16px;
|
| 178 |
+
border-radius: 8px;
|
| 179 |
+
border: 1px solid var(--border-color);
|
| 180 |
+
background-color: var(--chat-bg);
|
| 181 |
+
color: var(--text-color);
|
| 182 |
+
resize: none;
|
| 183 |
+
font-size: 1rem;
|
| 184 |
+
line-height: 1.5;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
textarea:focus {
|
| 188 |
+
outline: none;
|
| 189 |
+
border-color: var(--primary);
|
| 190 |
+
box-shadow: 0 0 0 1px var(--primary);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.typing-indicator {
|
| 194 |
+
display: flex;
|
| 195 |
+
gap: 4px;
|
| 196 |
+
padding: 0 20px 10px;
|
| 197 |
+
color: var(--text-secondary);
|
| 198 |
+
font-size: 0.9rem;
|
| 199 |
+
flex-shrink: 0; /* Prevent indicator from shrinking */
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.typing-dots {
|
| 203 |
+
display: flex;
|
| 204 |
+
gap: 2px;
|
| 205 |
+
align-items: flex-end;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.typing-dot {
|
| 209 |
+
width: 6px;
|
| 210 |
+
height: 6px;
|
| 211 |
+
background-color: var(--text-secondary);
|
| 212 |
+
border-radius: 50%;
|
| 213 |
+
animation: typingAnimation 1.4s infinite ease-in-out;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.typing-dot:nth-child(1) {
|
| 217 |
+
animation-delay: 0s;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.typing-dot:nth-child(2) {
|
| 221 |
+
animation-delay: 0.2s;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.typing-dot:nth-child(3) {
|
| 225 |
+
animation-delay: 0.4s;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
@keyframes typingAnimation {
|
| 229 |
+
0%, 60%, 100% { transform: translateY(0); }
|
| 230 |
+
30% { transform: translateY(-4px); }
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
footer {
|
| 234 |
+
background-color: var(--user-bg);
|
| 235 |
+
padding: 12px 20px;
|
| 236 |
+
border-top: 1px solid var(--border-color);
|
| 237 |
+
font-size: 0.8rem;
|
| 238 |
+
color: var(--text-secondary);
|
| 239 |
+
text-align: center;
|
| 240 |
+
flex-shrink: 0; /* Prevent footer from shrinking */
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
/* Side Panel Styles */
|
| 244 |
+
.side-panel {
|
| 245 |
+
position: fixed;
|
| 246 |
+
top: 0;
|
| 247 |
+
right: calc(-1 * var(--panel-width)); /* Initially hidden */
|
| 248 |
+
width: var(--panel-width);
|
| 249 |
+
height: 100vh;
|
| 250 |
+
background-color: var(--log-bg);
|
| 251 |
+
border-left: 1px solid var(--border-color);
|
| 252 |
+
box-shadow: -4px 0 12px rgba(0,0,0,0.15);
|
| 253 |
+
transition: right 0.3s ease-in-out;
|
| 254 |
+
display: flex;
|
| 255 |
+
flex-direction: column;
|
| 256 |
+
z-index: 999; /* Ensure it's above other content */
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.side-panel.open {
|
| 260 |
+
right: 0; /* Slide in */
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.side-panel-header {
|
| 264 |
+
padding: 12px 20px;
|
| 265 |
+
background-color: var(--user-bg);
|
| 266 |
+
border-bottom: 1px solid var(--border-color);
|
| 267 |
+
display: flex;
|
| 268 |
+
justify-content: space-between;
|
| 269 |
+
align-items: center;
|
| 270 |
+
flex-shrink: 0;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
.side-panel-header h3 {
|
| 274 |
+
font-size: 1rem;
|
| 275 |
+
margin: 0;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.side-panel-content {
|
| 279 |
+
flex: 1;
|
| 280 |
+
overflow-y: auto;
|
| 281 |
+
padding: 12px 20px;
|
| 282 |
+
font-size: 0.85rem;
|
| 283 |
+
color: var(--text-secondary);
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
.log-entry {
|
| 287 |
+
margin-bottom: 6px;
|
| 288 |
+
display: flex;
|
| 289 |
+
gap: 10px;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
.log-timestamp {
|
| 293 |
+
color: var(--text-secondary);
|
| 294 |
+
flex-shrink: 0;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
.log-message {
|
| 298 |
+
flex: 1;
|
| 299 |
+
word-break: break-word; /* Prevent long words from overflowing */
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
.log-error {
|
| 303 |
+
color: var(--error-color);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
.log-warning {
|
| 307 |
+
color: var(--warning-color);
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
.alert {
|
| 312 |
+
position: fixed;
|
| 313 |
+
top: 20px;
|
| 314 |
+
left: 50%;
|
| 315 |
+
transform: translateX(-50%);
|
| 316 |
+
padding: 12px 20px;
|
| 317 |
+
border-radius: 8px;
|
| 318 |
+
background-color: var(--error-color);
|
| 319 |
+
color: white;
|
| 320 |
+
z-index: 1000;
|
| 321 |
+
display: flex;
|
| 322 |
+
align-items: center;
|
| 323 |
+
gap: 8px;
|
| 324 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
| 325 |
+
animation: slideIn 0.3s ease-out;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
.alert-success {
|
| 329 |
+
background-color: var(--primary);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.alert-warning {
|
| 333 |
+
background-color: var(--warning-color);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
@keyframes slideIn {
|
| 337 |
+
from { top: -50px; opacity: 0; }
|
| 338 |
+
to { top: 20px; opacity: 1; }
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
.markdown-content pre {
|
| 342 |
+
background-color: rgba(0,0,0,0.2);
|
| 343 |
+
padding: 12px;
|
| 344 |
+
border-radius: 6px;
|
| 345 |
+
overflow-x: auto;
|
| 346 |
+
margin: 12px 0;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
.markdown-content code {
|
| 350 |
+
font-family: 'Courier New', Courier, monospace;
|
| 351 |
+
font-size: 0.9rem;
|
| 352 |
+
}
|
| 353 |
+
</style>
|
| 354 |
+
</head>
|
| 355 |
+
<body>
|
| 356 |
+
<nav>
|
| 357 |
+
<div class="nav-title">Agent Chat</div>
|
| 358 |
+
<div class="nav-actions">
|
| 359 |
+
<button class="btn">
|
| 360 |
+
<i class="fas fa-plus"></i> New Chat
|
| 361 |
+
</button>
|
| 362 |
+
<!-- Button to open logs panel -->
|
| 363 |
+
<button class="btn-icon" id="open-logs-btn" title="Show Logs">
|
| 364 |
+
<i class="fas fa-list-alt"></i>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
</button>
|
| 366 |
+
</div>
|
| 367 |
+
</nav>
|
| 368 |
+
|
| 369 |
+
<main>
|
| 370 |
+
<div class="chat-container" id="chat">
|
| 371 |
+
<!-- Messages will be inserted here -->
|
| 372 |
+
</div>
|
| 373 |
+
|
| 374 |
+
<div class="typing-indicator" id="typing-indicator" style="display: none;">
|
| 375 |
+
<div class="typing-dots">
|
| 376 |
+
<div class="typing-dot"></div>
|
| 377 |
+
<div class="typing-dot"></div>
|
| 378 |
+
<div class="typing-dot"></div>
|
| 379 |
+
</div>
|
| 380 |
+
<span>Agent is typing...</span>
|
| 381 |
+
</div>
|
| 382 |
+
|
| 383 |
+
<div class="input-container">
|
| 384 |
+
<div class="input-wrapper">
|
| 385 |
+
<textarea id="prompt" rows="1" placeholder="Message Agent..." autofocus></textarea>
|
| 386 |
+
<div class="input-actions">
|
| 387 |
+
<button class="btn-icon" id="upload-btn" title="Upload Database">
|
| 388 |
+
<i class="fas fa-database"></i>
|
| 389 |
+
</button>
|
| 390 |
+
<button class="btn-icon" id="send-btn" title="Send message">
|
| 391 |
+
<i class="fas fa-paper-plane"></i>
|
| 392 |
+
</button>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
</div>
|
| 396 |
+
|
| 397 |
+
</main>
|
| 398 |
+
|
| 399 |
+
<footer>
|
| 400 |
+
<div>Agent Chat v1.0 · © 2023</div>
|
| 401 |
+
</footer>
|
| 402 |
+
|
| 403 |
+
<!-- Side Panel for Logs -->
|
| 404 |
+
<div id="side-panel" class="side-panel">
|
| 405 |
+
<div class="side-panel-header">
|
| 406 |
+
<h3>Logs</h3>
|
| 407 |
+
<button class="btn-icon" id="close-panel-btn" title="Hide Logs">
|
| 408 |
+
<i class="fas fa-times"></i>
|
| 409 |
</button>
|
| 410 |
</div>
|
| 411 |
+
<div class="side-panel-content" id="logs">
|
| 412 |
+
<!-- Logs will be inserted here -->
|
| 413 |
+
</div>
|
| 414 |
</div>
|
| 415 |
+
|
| 416 |
+
<div id="flash-message" class="alert" style="display: none;"></div>
|
| 417 |
+
|
| 418 |
+
<script>
|
| 419 |
+
const socket = io();
|
| 420 |
+
const chatContainer = document.getElementById("chat");
|
| 421 |
+
const logsContainer = document.getElementById("logs"); // This is now the content div inside the panel
|
| 422 |
+
const sendButton = document.getElementById("send-btn");
|
| 423 |
+
const uploadButton = document.getElementById("upload-btn");
|
| 424 |
+
const promptTextarea = document.getElementById("prompt");
|
| 425 |
+
const flashMessage = document.getElementById('flash-message');
|
| 426 |
+
const typingIndicator = document.getElementById('typing-indicator');
|
| 427 |
+
|
| 428 |
+
// New elements for side panel
|
| 429 |
+
const sidePanel = document.getElementById('side-panel');
|
| 430 |
+
const openLogsBtn = document.getElementById('open-logs-btn');
|
| 431 |
+
const closePanelBtn = document.getElementById('close-panel-btn');
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
// Auto-resize textarea
|
| 435 |
+
promptTextarea.addEventListener('input', function() {
|
| 436 |
+
this.style.height = 'auto';
|
| 437 |
+
this.style.height = (this.scrollHeight) + 'px';
|
| 438 |
+
});
|
| 439 |
+
|
| 440 |
+
// Handle Enter key (Shift+Enter for new line)
|
| 441 |
+
promptTextarea.addEventListener('keydown', function(e) {
|
| 442 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
| 443 |
+
e.preventDefault();
|
| 444 |
+
sendMessage();
|
| 445 |
+
}
|
| 446 |
+
});
|
| 447 |
+
|
| 448 |
+
// Send button click handler
|
| 449 |
+
sendButton.addEventListener('click', sendMessage);
|
| 450 |
+
|
| 451 |
+
// Upload button click handler
|
| 452 |
+
uploadButton.addEventListener('click', () => {
|
| 453 |
+
window.location.href = '/upload';
|
| 454 |
+
});
|
| 455 |
+
|
| 456 |
+
// Side panel toggle handlers
|
| 457 |
+
openLogsBtn.addEventListener('click', () => {
|
| 458 |
+
sidePanel.classList.add('open');
|
| 459 |
+
});
|
| 460 |
+
|
| 461 |
+
closePanelBtn.addEventListener('click', () => {
|
| 462 |
+
sidePanel.classList.remove('open');
|
| 463 |
+
});
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
function sendMessage() {
|
| 467 |
+
const prompt = promptTextarea.value.trim();
|
| 468 |
+
if (!prompt) return;
|
| 469 |
+
|
| 470 |
+
addMessage("user", prompt);
|
| 471 |
+
promptTextarea.value = '';
|
| 472 |
+
promptTextarea.style.height = 'auto';
|
| 473 |
+
typingIndicator.style.display = 'flex';
|
| 474 |
+
|
| 475 |
+
fetch("/generate", {
|
| 476 |
+
method: "POST",
|
| 477 |
+
headers: { "Content-Type": "application/json" },
|
| 478 |
+
body: JSON.stringify({ prompt: prompt })
|
| 479 |
+
});
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
function addMessage(sender, text) {
|
| 483 |
+
const messageDiv = document.createElement("div");
|
| 484 |
+
messageDiv.classList.add("message", `message-${sender}`);
|
| 485 |
+
|
| 486 |
+
const avatarDiv = document.createElement("div");
|
| 487 |
+
avatarDiv.classList.add("avatar", `avatar-${sender}`);
|
| 488 |
+
avatarDiv.innerHTML = sender === 'user' ?
|
| 489 |
+
'<i class="fas fa-user"></i>' :
|
| 490 |
+
'<i class="fas fa-robot"></i>';
|
| 491 |
+
|
| 492 |
+
const contentDiv = document.createElement("div");
|
| 493 |
+
contentDiv.classList.add("message-content");
|
| 494 |
+
contentDiv.innerHTML = `<div class="markdown-content">${text}</div>`;
|
| 495 |
+
|
| 496 |
+
messageDiv.appendChild(avatarDiv);
|
| 497 |
+
messageDiv.appendChild(contentDiv);
|
| 498 |
+
chatContainer.appendChild(messageDiv);
|
| 499 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
function addLogMessage(text, type = 'info') {
|
| 503 |
+
const now = new Date();
|
| 504 |
+
const timestamp = now.toLocaleTimeString();
|
| 505 |
+
|
| 506 |
+
const logDiv = document.createElement("div");
|
| 507 |
+
logDiv.classList.add("log-entry");
|
| 508 |
+
|
| 509 |
+
const timeDiv = document.createElement("div");
|
| 510 |
+
timeDiv.classList.add("log-timestamp");
|
| 511 |
+
timeDiv.textContent = timestamp;
|
| 512 |
+
|
| 513 |
+
const messageDiv = document.createElement("div");
|
| 514 |
+
messageDiv.classList.add("log-message");
|
| 515 |
+
if (type !== 'info') messageDiv.classList.add(`log-${type}`);
|
| 516 |
+
messageDiv.textContent = text;
|
| 517 |
+
|
| 518 |
+
logDiv.appendChild(timeDiv);
|
| 519 |
+
logDiv.appendChild(messageDiv);
|
| 520 |
+
logsContainer.appendChild(logDiv); // Append to the logs content div
|
| 521 |
+
logsContainer.scrollTop = logsContainer.scrollHeight; // Scroll logs panel
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
function showFlashMessage(message, type = 'error') {
|
| 525 |
+
flashMessage.textContent = message;
|
| 526 |
+
flashMessage.className = `alert alert-${type}`;
|
| 527 |
+
flashMessage.style.display = 'flex';
|
| 528 |
+
|
| 529 |
+
setTimeout(() => {
|
| 530 |
+
flashMessage.style.display = 'none';
|
| 531 |
+
}, 3000);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
// Socket.io handlers
|
| 535 |
+
let agentMessageDiv = null;
|
| 536 |
+
|
| 537 |
+
socket.on("final_stream", (data) => {
|
| 538 |
+
if (!agentMessageDiv) {
|
| 539 |
+
agentMessageDiv = document.createElement("div");
|
| 540 |
+
agentMessageDiv.classList.add("message", "message-agent");
|
| 541 |
+
|
| 542 |
+
const avatarDiv = document.createElement("div");
|
| 543 |
+
avatarDiv.classList.add("avatar", "avatar-agent");
|
| 544 |
+
avatarDiv.innerHTML = '<i class="fas fa-robot"></i>';
|
| 545 |
+
|
| 546 |
+
const contentDiv = document.createElement("div");
|
| 547 |
+
contentDiv.classList.add("message-content");
|
| 548 |
+
contentDiv.id = "agent-message-content";
|
| 549 |
+
|
| 550 |
+
agentMessageDiv.appendChild(avatarDiv);
|
| 551 |
+
agentMessageDiv.appendChild(contentDiv);
|
| 552 |
+
chatContainer.appendChild(agentMessageDiv);
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
const contentDiv = document.getElementById("agent-message-content");
|
| 556 |
+
contentDiv.innerHTML = `<div class="markdown-content">${data.message}</div>`;
|
| 557 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 558 |
+
});
|
| 559 |
+
|
| 560 |
+
socket.on("final", (data) => {
|
| 561 |
+
typingIndicator.style.display = 'none';
|
| 562 |
+
|
| 563 |
+
if (agentMessageDiv) {
|
| 564 |
+
const contentDiv = document.getElementById("agent-message-content");
|
| 565 |
+
contentDiv.innerHTML = `<div class="markdown-content">${data.message}</div>`;
|
| 566 |
+
agentMessageDiv = null;
|
| 567 |
+
} else {
|
| 568 |
+
addMessage("agent", data.message);
|
| 569 |
+
}
|
| 570 |
+
});
|
| 571 |
+
|
| 572 |
+
socket.on("log", (data) => {
|
| 573 |
+
addLogMessage(data.message, data.type || 'info');
|
| 574 |
+
});
|
| 575 |
+
|
| 576 |
+
socket.on("error", (data) => {
|
| 577 |
+
showFlashMessage(data.message, 'error');
|
| 578 |
+
typingIndicator.style.display = 'none';
|
| 579 |
+
});
|
| 580 |
+
|
| 581 |
+
// Handle flash messages from server
|
| 582 |
+
if (flashMessage) {
|
| 583 |
+
setTimeout(() => {
|
| 584 |
+
flashMessage.style.display = 'none';
|
| 585 |
+
}, 3000);
|
| 586 |
+
}
|
| 587 |
+
</script>
|
| 588 |
+
</body>
|
| 589 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|