Spaces:
Running
Running
File size: 68,184 Bytes
278fe18 e9fd489 278fe18 fafb8cf 278fe18 e9fd489 278fe18 84ec515 278fe18 84ec515 278fe18 84ec515 278fe18 84ec515 278fe18 84ec515 278fe18 84ec515 278fe18 84ec515 4308f7c 0658ff8 84ec515 a7d8bc2 e9fd489 278fe18 84ec515 0658ff8 84ec515 0658ff8 278fe18 84ec515 e9fd489 b4c03fa 278fe18 84ec515 e9fd489 84ec515 a7d8bc2 fafb8cf a7d8bc2 e9fd489 a7d8bc2 84ec515 a7d8bc2 fafb8cf e9fd489 fafb8cf 84ec515 a7d8bc2 fafb8cf a7d8bc2 278fe18 e9fd489 278fe18 a7d8bc2 e9fd489 a7d8bc2 e9fd489 278fe18 a7d8bc2 e9fd489 a7d8bc2 278fe18 84ec515 a7d8bc2 fa5c6a6 278fe18 a7d8bc2 278fe18 a7d8bc2 0658ff8 84ec515 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 fafb8cf 84ec515 a7d8bc2 278fe18 84ec515 a7d8bc2 e9fd489 278fe18 84ec515 278fe18 84ec515 a7d8bc2 e9fd489 278fe18 84ec515 278fe18 84ec515 a7d8bc2 e9fd489 278fe18 84ec515 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 278fe18 e9fd489 0658ff8 84ec515 a7d8bc2 0658ff8 84ec515 0658ff8 e9fd489 0658ff8 84ec515 0658ff8 84ec515 0658ff8 a7d8bc2 0658ff8 84ec515 0658ff8 84ec515 0658ff8 a7d8bc2 0658ff8 a7d8bc2 84ec515 a7d8bc2 84ec515 0658ff8 84ec515 e9fd489 84ec515 e9fd489 a7d8bc2 0658ff8 84ec515 a7d8bc2 0658ff8 a7d8bc2 0658ff8 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 e9fd489 a7d8bc2 fafb8cf a7d8bc2 278fe18 | 1 2 3 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 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 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 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Multi-Model AI Agent System</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Previous styles remain the same */
@keyframes float {
0% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0px); }
}
.model-icon {
animation: float 4s ease-in-out infinite;
transition: all 0.3s ease;
border: 2px solid;
cursor: pointer;
}
.model-icon:hover {
transform: scale(1.05) !important;
animation-play-state: paused;
}
.llama {
animation-delay: 0s;
border-color: #3b82f6;
}
.gemma {
animation-delay: 0.5s;
border-color: #ef4444;
}
.hermes {
animation-delay: 1s;
border-color: #10b981;
}
.chat-container {
height: 600px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #4b5563 #1f2937;
}
.chat-container::-webkit-scrollbar {
width: 8px;
}
.chat-container::-webkit-scrollbar-track {
background: #1f2937;
}
.chat-container::-webkit-scrollbar-thumb {
background-color: #4b5563;
border-radius: 4px;
}
.message {
max-width: 80%;
word-wrap: break-word;
}
.typing-indicator {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #6b7280;
margin-right: 4px;
animation: bounce 1.5s infinite ease-in-out;
}
.typing-indicator:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
.model-badge {
background: linear-gradient(135deg, #6b46c1 0%, #3b82f6 100%);
color: white;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.7rem;
font-weight: bold;
margin-left: 5px;
}
.processing-queue {
position: fixed;
bottom: 20px;
right: 20px;
background: rgba(30, 41, 59, 0.9);
border: 1px solid #334155;
border-radius: 8px;
padding: 15px;
width: 300px;
z-index: 100;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
.queue-header {
font-weight: bold;
color: #f59e0b;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.queue-item {
padding: 5px 0;
border-bottom: 1px solid #334155;
display: flex;
align-items: center;
}
.queue-item:last-child {
border-bottom: none;
}
.queue-status {
width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 8px;
}
.status-pending {
background-color: #f59e0b;
animation: pulse 2s infinite;
}
.status-processing {
background-color: #3b82f6;
animation: pulse 1s infinite;
}
.status-completed {
background-color: #10b981;
}
.status-failed {
background-color: #ef4444;
}
.queue-item-name {
flex-grow: 1;
font-size: 0.9rem;
}
.queue-item-time {
font-size: 0.8rem;
color: #9ca3af;
}
.priority-badge {
background-color: #ef4444;
color: white;
font-size: 0.6rem;
padding: 2px 4px;
border-radius: 4px;
margin-left: 5px;
}
.task-container {
background: rgba(30, 41, 59, 0.8);
border: 1px solid #334155;
border-radius: 8px;
padding: 15px;
margin: 10px 0;
}
.task-header {
font-weight: bold;
color: #f59e0b;
margin-bottom: 8px;
display: flex;
align-items: center;
}
.task-content {
background: rgba(15, 23, 42, 0.5);
padding: 10px;
border-radius: 5px;
font-family: monospace;
white-space: pre-wrap;
font-size: 0.9rem;
}
.model-analysis {
border-left: 4px solid;
padding: 10px;
margin: 10px 0;
border-radius: 0 5px 5px 0;
}
.llama-analysis {
border-left-color: #3b82f6;
background: rgba(59, 130, 246, 0.1);
}
.gemma-analysis {
border-left-color: #ef4444;
background: rgba(239, 68, 68, 0.1);
}
.hermes-analysis {
border-left-color: #10b981;
background: rgba(16, 185, 129, 0.1);
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.highlight {
animation: highlight-pulse 1.5s ease-out;
}
@keyframes highlight-pulse {
0% { background-color: rgba(245, 158, 11, 0); }
50% { background-color: rgba(245, 158, 11, 0.3); }
100% { background-color: rgba(245, 158, 11, 0); }
}
/* New styles for agent system */
.agent-panel {
background: rgba(15, 23, 42, 0.8);
border: 1px solid #334155;
border-radius: 8px;
padding: 15px;
margin-bottom: 20px;
}
.agent-controls {
display: flex;
gap: 10px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.agent-status {
display: flex;
align-items: center;
padding: 5px 10px;
border-radius: 4px;
font-size: 0.85rem;
}
.status-active {
background-color: rgba(16, 185, 129, 0.2);
color: #10b981;
}
.status-inactive {
background-color: rgba(239, 68, 68, 0.2);
color: #ef4444;
}
.agent-memory {
background: rgba(30, 41, 59, 0.5);
border-radius: 6px;
padding: 10px;
margin-top: 10px;
font-size: 0.85rem;
}
.model-config {
background: rgba(30, 41, 59, 0.5);
border-radius: 6px;
padding: 10px;
margin-top: 10px;
}
.config-item {
margin-bottom: 8px;
display: flex;
align-items: center;
}
.config-label {
width: 120px;
font-size: 0.85rem;
color: #9ca3af;
}
.config-value {
flex-grow: 1;
font-size: 0.85rem;
}
.toggle-switch {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #4b5563;
transition: .4s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
height: 16px;
width: 16px;
left: 4px;
bottom: 4px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #3b82f6;
}
input:checked + .slider:before {
transform: translateX(26px);
}
.agent-task {
background: rgba(30, 41, 59, 0.5);
border-radius: 6px;
padding: 10px;
margin-top: 10px;
font-size: 0.85rem;
}
.task-progress {
height: 6px;
background-color: #1e293b;
border-radius: 3px;
margin-top: 5px;
overflow: hidden;
}
.progress-bar {
height: 100%;
background-color: #3b82f6;
border-radius: 3px;
transition: width 0.3s ease;
}
.system-monitor {
background: rgba(15, 23, 42, 0.8);
border: 1px solid #334155;
border-radius: 8px;
padding: 15px;
margin-bottom: 20px;
}
.monitor-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 10px;
margin-top: 10px;
}
.monitor-card {
background: rgba(30, 41, 59, 0.5);
border-radius: 6px;
padding: 10px;
text-align: center;
}
.monitor-value {
font-size: 1.2rem;
font-weight: bold;
margin: 5px 0;
}
.monitor-label {
font-size: 0.75rem;
color: #9ca3af;
}
.resource-graph {
height: 120px;
margin-top: 10px;
}
/* New styles for context awareness */
.context-badge {
background-color: #8b5cf6;
color: white;
font-size: 0.6rem;
padding: 2px 4px;
border-radius: 4px;
margin-left: 5px;
}
.context-memory {
background: rgba(30, 41, 59, 0.7);
border-radius: 6px;
padding: 10px;
margin-top: 10px;
font-size: 0.85rem;
border-left: 3px solid #8b5cf6;
}
.context-item {
margin-bottom: 5px;
display: flex;
align-items: center;
}
.context-key {
font-weight: bold;
color: #8b5cf6;
margin-right: 5px;
}
.context-value {
flex-grow: 1;
font-size: 0.85rem;
}
.follow-up-button {
background-color: rgba(139, 92, 246, 0.2);
color: #8b5cf6;
border: 1px solid #8b5cf6;
border-radius: 4px;
padding: 2px 6px;
font-size: 0.75rem;
margin-top: 5px;
cursor: pointer;
transition: all 0.2s;
}
.follow-up-button:hover {
background-color: rgba(139, 92, 246, 0.4);
}
.analysis-section {
background: rgba(30, 41, 59, 0.5);
border-radius: 6px;
padding: 10px;
margin-top: 10px;
font-size: 0.85rem;
border-left: 3px solid #f59e0b;
}
.analysis-title {
font-weight: bold;
color: #f59e0b;
margin-bottom: 5px;
}
</style>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<!-- Processing Queue -->
<div class="processing-queue" id="processingQueue">
<div class="queue-header">
<span><i class="fas fa-tasks mr-2"></i>AI Processing Queue</span>
<span id="queueCount">0</span>
</div>
<div id="queueItems">
<!-- Queue items will be added here -->
</div>
</div>
<div class="container mx-auto px-4 py-8">
<h1 class="text-4xl font-bold text-center mb-8 text-yellow-500">
<i class="fas fa-robot mr-2"></i>Advanced Multi-Model AI Agent System
<i class="fas fa-brain ml-2"></i>
</h1>
<div class="text-center mb-8">
<p class="text-lg text-gray-400">Context-aware agent system with LLaMA 3.2:1B, Gemma 3:1B, and Nous-Hermes 2</p>
</div>
<!-- System Monitor -->
<div class="system-monitor mb-8">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-chart-line mr-2"></i>System Monitor
</h2>
<div class="monitor-grid">
<div class="monitor-card">
<div class="monitor-label">Total Models</div>
<div class="monitor-value" id="totalModels">3</div>
<div class="monitor-label">Active</div>
</div>
<div class="monitor-card">
<div class="monitor-label">Queue Length</div>
<div class="monitor-value" id="queueLength">0</div>
<div class="monitor-label">Tasks</div>
</div>
<div class="monitor-card">
<div class="monitor-label">LLaMA Load</div>
<div class="monitor-value" id="llamaLoad">0%</div>
<div class="resource-graph">
<canvas id="llamaChart"></canvas>
</div>
</div>
<div class="monitor-card">
<div class="monitor-label">Gemma Load</div>
<div class="monitor-value" id="gemmaLoad">0%</div>
<div class="resource-graph">
<canvas id="gemmaChart"></canvas>
</div>
</div>
<div class="monitor-card">
<div class="monitor-label">Hermes Load</div>
<div class="monitor-value" id="hermesLoad">0%</div>
<div class="resource-graph">
<canvas id="hermesChart"></canvas>
</div>
</div>
<div class="monitor-card">
<div class="monitor-label">Memory Usage</div>
<div class="monitor-value" id="memoryUsage">0 MB</div>
<div class="resource-graph">
<canvas id="memoryChart"></canvas>
</div>
</div>
<div class="monitor-card">
<div class="monitor-label">Context Items</div>
<div class="monitor-value" id="contextItems">0</div>
<div class="monitor-label">Active</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
<!-- Left Column - Model Configuration -->
<div class="lg:col-span-1 space-y-6">
<!-- Model Configuration -->
<div class="agent-panel">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-cog mr-2"></i>Model Configuration
</h2>
<div class="model-config">
<div class="config-item">
<div class="config-label">LLaMA 3.2:1B</div>
<div class="config-value">
<label class="toggle-switch">
<input type="checkbox" id="llamaToggle" checked>
<span class="slider"></span>
</label>
<span class="ml-2 text-sm" id="llamaStatus">Active</span>
</div>
</div>
<div class="config-item">
<div class="config-label">Gemma 3:1B</div>
<div class="config-value">
<label class="toggle-switch">
<input type="checkbox" id="gemmaToggle" checked>
<span class="slider"></span>
</label>
<span class="ml-2 text-sm" id="gemmaStatus">Active</span>
</div>
</div>
<div class="config-item">
<div class="config-label">Hermes 2</div>
<div class="config-value">
<label class="toggle-switch">
<input type="checkbox" id="hermesToggle" checked>
<span class="slider"></span>
</label>
<span class="ml-2 text-sm" id="hermesStatus">Active</span>
</div>
</div>
<div class="config-item">
<div class="config-label">Priority Mode</div>
<div class="config-value">
<label class="toggle-switch">
<input type="checkbox" id="priorityToggle" checked>
<span class="slider"></span>
</label>
<span class="ml-2 text-sm" id="priorityStatus">Enabled</span>
</div>
</div>
<div class="config-item">
<div class="config-label">Context Mode</div>
<div class="config-value">
<label class="toggle-switch">
<input type="checkbox" id="contextToggle" checked>
<span class="slider"></span>
</label>
<span class="ml-2 text-sm" id="contextStatus">Enabled</span>
</div>
</div>
</div>
<div class="mt-4">
<button id="saveConfig" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800 w-full">
<i class="fas fa-save mr-2"></i>Save Configuration
</button>
</div>
</div>
<!-- Agent Controls -->
<div class="agent-panel">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-sliders-h mr-2"></i>Agent Controls
</h2>
<div class="agent-controls">
<button id="startAgent" class="bg-green-700 hover:bg-green-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-green-800 flex-1">
<i class="fas fa-play mr-2"></i>Start
</button>
<button id="pauseAgent" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800 flex-1">
<i class="fas fa-pause mr-2"></i>Pause
</button>
<button id="resetAgent" class="bg-red-700 hover:bg-red-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-red-800 flex-1">
<i class="fas fa-redo mr-2"></i>Reset
</button>
</div>
<div class="agent-status status-active mt-4" id="agentStatusDisplay">
<i class="fas fa-circle mr-2"></i>System Status: <span id="agentStatusText">Running</span>
</div>
<div class="agent-memory">
<div class="flex justify-between">
<span>Agent Memory:</span>
<span id="memoryUsageSmall">0 MB</span>
</div>
<div class="task-progress">
<div class="progress-bar" id="memoryProgress" style="width: 0%"></div>
</div>
</div>
</div>
<!-- Context Memory -->
<div class="agent-panel" id="contextPanel">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-memory mr-2"></i>Context Memory
</h2>
<div id="contextMemory" class="context-memory">
<div class="text-center text-gray-400">No context items yet</div>
</div>
<div class="mt-4">
<button id="clearContext" class="bg-purple-700 hover:bg-purple-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-purple-800 w-full">
<i class="fas fa-trash-alt mr-2"></i>Clear Context
</button>
</div>
</div>
</div>
<!-- Middle Column - Chat Interface -->
<div class="lg:col-span-2">
<div class="agent-panel">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-comments mr-2"></i>Multi-Model Conversation
</h2>
<div class="chat-container bg-gray-700 rounded-lg p-4 mb-4 border border-gray-600">
<div id="chatLog" class="space-y-3">
<div class="message bg-blue-900/70 rounded-lg p-3 ml-0 border border-blue-700">
<div class="font-bold text-blue-300">System <span class="model-badge">Agent</span>:</div>
<p>Advanced Multi-Model AI Agent System initialized with context awareness.</p>
<p>LLaMA 3.2:1B, Gemma 3:1B, and Nous-Hermes 2 are ready for integrated processing.</p>
</div>
<div class="message bg-purple-900/70 rounded-lg p-3 ml-0 border border-purple-700">
<div class="font-bold text-purple-300">System <span class="model-badge">Priority</span>:</div>
<p>LLaMA 3.2:1B has priority processing enabled. Other models will wait for LLaMA completion before proceeding.</p>
</div>
<div class="message bg-indigo-900/70 rounded-lg p-3 ml-0 border border-indigo-700">
<div class="font-bold text-indigo-300">System <span class="model-badge">Context</span>:</div>
<p>Context awareness is enabled. The system will maintain conversation context for more coherent responses.</p>
</div>
</div>
</div>
<div id="typingIndicator" class="hidden flex items-center space-x-1 mb-2 pl-2">
<span class="text-sm text-gray-400">AI typing:</span>
<div class="typing-indicator"></div>
<div class="typing-indicator"></div>
<div class="typing-indicator"></div>
<span class="text-sm text-gray-400 ml-2" id="typingModel"></span>
</div>
<div class="flex space-x-2">
<input type="text" id="userInput" placeholder="Enter your query or task for the AI agents..." class="flex-1 bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-700 border border-gray-600 placeholder-gray-500">
<button id="sendButton" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800">
<i class="fas fa-paper-plane mr-1"></i>Send
</button>
</div>
<div class="mt-4 flex flex-wrap gap-2">
<button class="model-prompt bg-blue-900/50 hover:bg-blue-800 text-blue-100 font-bold px-3 py-1 rounded-lg transition border border-blue-700 text-sm" data-model="llama">
<i class="fas fa-brain mr-1"></i>Ask LLaMA 3.2
</button>
<button class="model-prompt bg-red-900/50 hover:bg-red-800 text-red-100 font-bold px-3 py-1 rounded-lg transition border border-red-700 text-sm" data-model="gemma">
<i class="fas fa-gem mr-1"></i>Ask Gemma 3
</button>
<button class="model-prompt bg-green-900/50 hover:bg-green-800 text-green-100 font-bold px-3 py-1 rounded-lg transition border border-green-700 text-sm" data-model="hermes">
<i class="fas fa-feather-alt mr-1"></i>Ask Hermes 2
</button>
<button class="model-prompt bg-purple-900/50 hover:bg-purple-800 text-purple-100 font-bold px-3 py-1 rounded-lg transition border border-purple-700 text-sm" data-model="all">
<i class="fas fa-robot mr-1"></i>Ask All Models
</button>
<button class="model-prompt bg-yellow-900/50 hover:bg-yellow-800 text-yellow-100 font-bold px-3 py-1 rounded-lg transition border border-yellow-700 text-sm" data-model="task">
<i class="fas fa-tasks mr-1"></i>Create Task
</button>
<button class="model-prompt bg-indigo-900/50 hover:bg-indigo-800 text-indigo-100 font-bold px-3 py-1 rounded-lg transition border border-indigo-700 text-sm" data-model="clarify">
<i class="fas fa-question-circle mr-1"></i>Request Clarification
</button>
</div>
</div>
<!-- Task Management -->
<div class="agent-panel mt-6">
<h2 class="text-2xl font-semibold mb-4 text-yellow-500">
<i class="fas fa-tasks mr-2"></i>Task Management
</h2>
<div id="activeTasks" class="space-y-3">
<div class="agent-task">
<div class="flex justify-between">
<span class="font-medium">System Initialization</span>
<span class="text-sm text-green-400">Completed</span>
</div>
<div class="text-sm text-gray-400 mt-1">Initialized all AI models and agent systems</div>
<div class="task-progress">
<div class="progress-bar" style="width: 100%"></div>
</div>
</div>
</div>
<div class="mt-4">
<button id="clearTasks" class="bg-red-700 hover:bg-red-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-red-800 w-full">
<i class="fas fa-trash-alt mr-2"></i>Clear Completed Tasks
</button>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// DOM Elements
const chatLog = document.getElementById('chatLog');
const userInput = document.getElementById('userInput');
const sendButton = document.getElementById('sendButton');
const typingIndicator = document.getElementById('typingIndicator');
const typingModel = document.getElementById('typingModel');
const processingQueue = document.getElementById('processingQueue');
const queueItems = document.getElementById('queueItems');
const queueCount = document.getElementById('queueCount');
const modelPrompts = document.querySelectorAll('.model-prompt');
const activeTasks = document.getElementById('activeTasks');
const contextMemory = document.getElementById('contextMemory');
const clearContext = document.getElementById('clearContext');
const contextItems = document.getElementById('contextItems');
// Configuration elements
const llamaToggle = document.getElementById('llamaToggle');
const gemmaToggle = document.getElementById('gemmaToggle');
const hermesToggle = document.getElementById('hermesToggle');
const priorityToggle = document.getElementById('priorityToggle');
const contextToggle = document.getElementById('contextToggle');
const llamaStatus = document.getElementById('llamaStatus');
const gemmaStatus = document.getElementById('gemmaStatus');
const hermesStatus = document.getElementById('hermesStatus');
const priorityStatus = document.getElementById('priorityStatus');
const contextStatus = document.getElementById('contextStatus');
const saveConfig = document.getElementById('saveConfig');
// Agent control elements
const startAgent = document.getElementById('startAgent');
const pauseAgent = document.getElementById('pauseAgent');
const resetAgent = document.getElementById('resetAgent');
const agentStatusDisplay = document.getElementById('agentStatusDisplay');
const agentStatusText = document.getElementById('agentStatusText');
const clearTasks = document.getElementById('clearTasks');
// Monitor elements
const totalModels = document.getElementById('totalModels');
const queueLength = document.getElementById('queueLength');
const llamaLoad = document.getElementById('llamaLoad');
const gemmaLoad = document.getElementById('gemmaLoad');
const hermesLoad = document.getElementById('hermesLoad');
const memoryUsage = document.getElementById('memoryUsage');
const memoryUsageSmall = document.getElementById('memoryUsageSmall');
const memoryProgress = document.getElementById('memoryProgress');
// System state
let isAgentRunning = true;
let processingQueueItems = [];
let currentProcessingItem = null;
let isProcessing = false;
let activeTaskCount = 1;
let memoryUsageValue = 0;
let conversationContext = [];
let isContextEnabled = true;
// Initialize charts
const llamaChart = initChart('llamaChart', '#3b82f6');
const gemmaChart = initChart('gemmaChart', '#ef4444');
const hermesChart = initChart('hermesChart', '#10b981');
const memoryChart = initChart('memoryChart', '#f59e0b');
// Available models
const models = {
llama: {
name: "LLaMA 3.2:1B",
color: "blue",
icon: "brain",
description: "Most advanced model with priority processing",
endpoint: "http://localhost:11434/api/generate",
isActive: true,
isPriority: true,
load: 0,
personality: "analytical and thorough",
capabilities: ["deep analysis", "complex reasoning", "contextual understanding"]
},
gemma: {
name: "Gemma 3:1B",
color: "red",
icon: "gem",
description: "Fast inference for less critical tasks",
endpoint: "http://localhost:11434/api/generate",
isActive: true,
isPriority: false,
load: 0,
personality: "concise and factual",
capabilities: ["quick responses", "fact retrieval", "summarization"]
},
hermes: {
name: "Nous-Hermes 2",
color: "green",
icon: "feather-alt",
description: "Creative and nuanced responses",
endpoint: "http://localhost:11434/api/generate",
isActive: true,
isPriority: false,
load: 0,
personality: "creative and expressive",
capabilities: ["creative writing", "alternative perspectives", "nuanced interpretation"]
}
};
// Initialize the system
initSystem();
// Event listeners
sendButton.addEventListener('click', handleSendMessage);
userInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') handleSendMessage();
});
modelPrompts.forEach(button => {
button.addEventListener('click', function() {
const model = this.getAttribute('data-model');
if (model === 'all') {
handleSendMessage(true);
} else if (model === 'task') {
createTask(userInput.value || "New task from user");
} else if (model === 'clarify') {
requestClarification();
} else {
userInput.value = `[${model}] ${userInput.value}`;
handleSendMessage();
}
});
});
// Configuration event listeners
llamaToggle.addEventListener('change', function() {
models.llama.isActive = this.checked;
llamaStatus.textContent = this.checked ? 'Active' : 'Inactive';
llamaStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`;
updateSystemMonitor();
});
gemmaToggle.addEventListener('change', function() {
models.gemma.isActive = this.checked;
gemmaStatus.textContent = this.checked ? 'Active' : 'Inactive';
gemmaStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`;
updateSystemMonitor();
});
hermesToggle.addEventListener('change', function() {
models.hermes.isActive = this.checked;
hermesStatus.textContent = this.checked ? 'Active' : 'Inactive';
hermesStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`;
updateSystemMonitor();
});
priorityToggle.addEventListener('change', function() {
models.llama.isPriority = this.checked;
priorityStatus.textContent = this.checked ? 'Enabled' : 'Disabled';
priorityStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`;
// Add system message
addSystemMessage(
`Priority processing ${this.checked ? 'enabled' : 'disabled'} for LLaMA 3.2:1B`,
this.checked ? 'blue' : 'gray'
);
updateSystemMonitor();
});
contextToggle.addEventListener('change', function() {
isContextEnabled = this.checked;
contextStatus.textContent = this.checked ? 'Enabled' : 'Disabled';
contextStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`;
// Add system message
addSystemMessage(
`Context awareness ${this.checked ? 'enabled' : 'disabled'}`,
this.checked ? 'indigo' : 'gray'
);
updateSystemMonitor();
});
saveConfig.addEventListener('click', function() {
addSystemMessage("Configuration saved successfully", "green");
});
// Agent control event listeners
startAgent.addEventListener('click', function() {
isAgentRunning = true;
agentStatusText.textContent = "Running";
agentStatusDisplay.className = "agent-status status-active mt-4";
addSystemMessage("Agent system started", "green");
});
pauseAgent.addEventListener('click', function() {
isAgentRunning = false;
agentStatusText.textContent = "Paused";
agentStatusDisplay.className = "agent-status status-inactive mt-4";
addSystemMessage("Agent system paused", "yellow");
});
resetAgent.addEventListener('click', function() {
if (confirm("Are you sure you want to reset the agent system? This will clear all pending tasks and context.")) {
processingQueueItems = [];
conversationContext = [];
updateQueueDisplay();
updateContextDisplay();
isAgentRunning = true;
agentStatusText.textContent = "Running";
agentStatusDisplay.className = "agent-status status-active mt-4";
addSystemMessage("Agent system reset", "blue");
}
});
clearTasks.addEventListener('click', function() {
const completedTasks = activeTasks.querySelectorAll('.agent-task');
completedTasks.forEach(task => {
if (task.querySelector('.text-green-400')) {
task.remove();
}
});
});
clearContext.addEventListener('click', function() {
if (confirm("Are you sure you want to clear all context memory?")) {
conversationContext = [];
updateContextDisplay();
addSystemMessage("Context memory cleared", "indigo");
}
});
// Initialize the system
function initSystem() {
// Start monitoring system resources
setInterval(updateSystemResources, 2000);
// Add initial tasks
createTask("Initialize LLaMA 3.2:1B model");
createTask("Initialize Gemma 3:1B model");
createTask("Initialize Hermes 2 model");
createTask("Start agent system");
createTask("Load context awareness module");
// Simulate task completion
setTimeout(() => {
const tasks = activeTasks.querySelectorAll('.agent-task');
tasks.forEach(task => {
const progress = task.querySelector('.progress-bar');
if (progress) progress.style.width = "100%";
const status = task.querySelector('.text-sm');
if (status) {
status.textContent = "Completed";
status.className = "text-sm text-green-400";
}
});
}, 3000);
}
// Handle sending messages
function handleSendMessage(sendToAll = false) {
const message = userInput.value.trim();
if (!message) return;
// Add user message to chat
addMessage("user", message);
// Add to context if enabled
if (isContextEnabled) {
addToContext("user", message);
}
// Clear input
userInput.value = '';
if (sendToAll) {
// Send to all active models
Object.keys(models).forEach(model => {
if (models[model].isActive) {
const taskName = `Process "${message.substring(0, 20)}..." with ${models[model].name}`;
const taskId = addToQueue(taskName, model, models[model].isPriority);
createTask(taskName, taskId);
}
});
} else {
// Determine which model to use
let selectedModel = 'llama'; // default
// Check for model specifier in message
if (message.match(/\[llama\]|\[LLaMA\]/i)) {
selectedModel = 'llama';
} else if (message.match(/\[gemma\]|\[Gemma\]/i)) {
selectedModel = 'gemma';
} else if (message.match(/\[hermes\]|\[Hermes\]/i)) {
selectedModel = 'hermes';
}
// Clean the message by removing model specifier
const cleanMessage = message.replace(/^\[[^\]]+\]\s*/i, '');
if (models[selectedModel].isActive) {
const taskName = `Process "${cleanMessage.substring(0, 20)}..." with ${models[selectedModel].name}`;
const taskId = addToQueue(taskName, selectedModel, models[selectedModel].isPriority);
createTask(taskName, taskId);
} else {
addSystemMessage(`${models[selectedModel].name} is currently inactive`, "red");
}
}
}
// Request clarification from user
function requestClarification() {
const message = userInput.value.trim();
if (!message) return;
// Add user message to chat
addMessage("user", message);
// Add to context if enabled
if (isContextEnabled) {
addToContext("user", message);
}
// Clear input
userInput.value = '';
// Create clarification request task
const taskName = `Request clarification for: "${message.substring(0, 20)}..."`;
const taskId = addToQueue(taskName, 'llama', true);
createTask(taskName, taskId);
}
// Add message to chat
function addMessage(sender, message, model = null) {
const messageDiv = document.createElement('div');
if (sender === 'user') {
messageDiv.className = 'message bg-gray-800 rounded-lg p-3 mr-0 ml-auto border border-gray-600';
messageDiv.innerHTML = `
<div class="font-bold text-gray-300">You:</div>
<p>${message}</p>
`;
} else if (sender === 'ai') {
const modelData = models[model] || { name: 'AI', color: 'gray' };
messageDiv.className = `message bg-${modelData.color}-900/70 rounded-lg p-3 ml-0 border border-${modelData.color}-700`;
// Check if message contains analysis sections
if (message.includes('Analysis:')) {
const parts = message.split('Analysis:');
messageDiv.innerHTML = `
<div class="font-bold text-${modelData.color}-300">${modelData.name} <span class="model-badge">${modelData.name.split(' ')[0]}</span>:</div>
<p>${parts[0]}</p>
<div class="analysis-section">
<div class="analysis-title">Analysis:</div>
<div>${parts[1]}</div>
</div>
`;
} else {
messageDiv.innerHTML = `
<div class="font-bold text-${modelData.color}-300">${modelData.name} <span class="model-badge">${modelData.name.split(' ')[0]}</span>:</div>
<p>${message}</p>
`;
}
// Add follow-up buttons if context is enabled
if (isContextEnabled) {
const followUpDiv = document.createElement('div');
followUpDiv.className = 'mt-2 flex gap-2';
const expandButton = document.createElement('button');
expandButton.className = 'follow-up-button';
expandButton.innerHTML = '<i class="fas fa-expand mr-1"></i>Expand';
expandButton.addEventListener('click', () => {
const expandedTaskName = `Expand on: "${message.substring(0, 20)}..."`;
const expandedTaskId = addToQueue(expandedTaskName, model, models[model].isPriority);
createTask(expandedTaskName, expandedTaskId);
});
const exampleButton = document.createElement('button');
exampleButton.className = 'follow-up-button';
exampleButton.innerHTML = '<i class="fas fa-lightbulb mr-1"></i>Examples';
exampleButton.addEventListener('click', () => {
const exampleTaskName = `Provide examples for: "${message.substring(0, 20)}..."`;
const exampleTaskId = addToQueue(exampleTaskName, model, models[model].isPriority);
createTask(exampleTaskName, exampleTaskId);
});
followUpDiv.appendChild(expandButton);
followUpDiv.appendChild(exampleButton);
messageDiv.appendChild(followUpDiv);
}
}
chatLog.appendChild(messageDiv);
chatLog.scrollTop = chatLog.scrollHeight;
}
// Add system message
function addSystemMessage(message, color = 'blue') {
const messageDiv = document.createElement('div');
messageDiv.className = `message bg-${color}-900/70 rounded-lg p-3 ml-0 border border-${color}-700`;
messageDiv.innerHTML = `
<div class="font-bold text-${color}-300">System <span class="model-badge">${color === 'blue' ? 'Priority' : (color === 'green' ? 'Success' : (color === 'indigo' ? 'Context' : 'Alert'))}</span>:</div>
<p>${message}</p>
`;
chatLog.appendChild(messageDiv);
chatLog.scrollTop = chatLog.scrollHeight;
}
// Add to conversation context
function addToContext(sender, message) {
conversationContext.push({
sender: sender,
message: message,
timestamp: new Date()
});
// Keep only the last 10 messages to prevent memory overload
if (conversationContext.length > 10) {
conversationContext.shift();
}
updateContextDisplay();
}
// Update context display
function updateContextDisplay() {
contextMemory.innerHTML = '';
if (conversationContext.length === 0) {
contextMemory.innerHTML = '<div class="text-center text-gray-400">No context items yet</div>';
contextItems.textContent = '0';
return;
}
contextItems.textContent = conversationContext.length;
conversationContext.forEach((item, index) => {
const contextItem = document.createElement('div');
contextItem.className = 'context-item';
const senderClass = item.sender === 'user' ? 'text-gray-300' : `text-${models[item.model]?.color || 'gray'}-300`;
const senderName = item.sender === 'user' ? 'You' : (models[item.model]?.name || 'AI');
contextItem.innerHTML = `
<div class="context-key">${senderName}:</div>
<div class="context-value">${item.message.substring(0, 50)}${item.message.length > 50 ? '...' : ''}</div>
`;
contextMemory.appendChild(contextItem);
});
}
// Add item to processing queue
function addToQueue(itemName, model, isPriority = false) {
if (!isAgentRunning) {
addSystemMessage("Agent system is paused. Start the agent to process tasks.", "red");
return null;
}
const queueItem = {
id: Date.now(),
name: itemName,
model: model,
status: 'pending',
timestamp: new Date(),
isPriority: isPriority || models[model].isPriority,
context: isContextEnabled ? [...conversationContext] : []
};
// Add to beginning if priority, else to end
if (queueItem.isPriority) {
processingQueueItems.unshift(queueItem);
} else {
processingQueueItems.push(queueItem);
}
updateQueueDisplay();
processQueue();
return queueItem.id;
}
// Update queue display
function updateQueueDisplay() {
queueItems.innerHTML = '';
queueCount.textContent = processingQueueItems.length;
queueLength.textContent = processingQueueItems.length;
// Sort items: processing first, then priority, then by timestamp
const sortedItems = [...processingQueueItems].sort((a, b) => {
if (a.status === 'processing') return -1;
if (b.status === 'processing') return 1;
if (a.isPriority && !b.isPriority) return -1;
if (!a.isPriority && b.isPriority) return 1;
return a.timestamp - b.timestamp;
});
sortedItems.forEach(item => {
const itemDiv = document.createElement('div');
itemDiv.className = 'queue-item';
let statusClass = '';
switch(item.status) {
case 'pending': statusClass = 'status-pending'; break;
case 'processing': statusClass = 'status-processing'; break;
case 'completed': statusClass = 'status-completed'; break;
case 'failed': statusClass = 'status-failed'; break;
}
const modelColor = models[item.model] ? models[item.model].color : 'gray';
itemDiv.innerHTML = `
<div class="queue-status ${statusClass}"></div>
<div class="queue-item-name">
${item.name}
${item.isPriority ? '<span class="priority-badge">PRIORITY</span>' : ''}
<span class="text-xs text-${modelColor}-400">${models[item.model]?.name || item.model}</span>
</div>
<div class="queue-item-time">${formatTime(item.timestamp)}</div>
`;
queueItems.appendChild(itemDiv);
});
}
// Process queue items
async function processQueue() {
if (isProcessing || processingQueueItems.length === 0) return;
isProcessing = true;
// Find next item to process (prioritize pending priority items)
let nextItem = processingQueueItems.find(item =>
item.status === 'pending' && item.isPriority
) || processingQueueItems.find(item =>
item.status === 'pending'
);
if (!nextItem) {
isProcessing = false;
return;
}
// Mark as processing
updateQueueItemStatus(nextItem.id, 'processing');
currentProcessingItem = nextItem;
// Show typing indicator
typingModel.textContent = models[nextItem.model].name;
typingIndicator.classList.remove('hidden');
try {
// Update model load
models[nextItem.model].load = 70 + Math.random() * 20;
updateSystemMonitor();
// Simulate processing delay based on model
let processingTime = 1500 + Math.random() * 1000; // Default
if (nextItem.model === 'llama') processingTime = 2500 + Math.random() * 1500;
else if (nextItem.model === 'gemma') processingTime = 800 + Math.random() * 500;
await new Promise(resolve => setTimeout(resolve, processingTime));
// Mark as completed
updateQueueItemStatus(nextItem.id, 'completed');
// Generate response with context awareness
const response = generateResponse(nextItem.name, nextItem.model, nextItem.context);
displayResponse(response, nextItem.model);
// Add to context if enabled
if (isContextEnabled) {
addToContext('ai', response, nextItem.model);
}
// Update task status
updateTaskStatus(nextItem.id);
} catch (error) {
// Mark as failed
updateQueueItemStatus(nextItem.id, 'failed');
console.error('Processing error:', error);
// Show error message
addSystemMessage(`Failed to process ${models[nextItem.model]?.name || nextItem.model} request: ${error.message}`, "red");
} finally {
// Hide typing indicator
typingIndicator.classList.add('hidden');
// Update model load
models[nextItem.model].load = 0;
updateSystemMonitor();
currentProcessingItem = null;
isProcessing = false;
// Process next item if available
setTimeout(processQueue, 500);
}
}
// Update queue item status
function updateQueueItemStatus(id, status) {
const item = processingQueueItems.find(i => i.id === id);
if (item) {
item.status = status;
updateQueueDisplay();
}
}
// Generate mock response based on model and context
function generateResponse(prompt, model, context = []) {
const modelData = models[model];
const contextSummary = context.length > 0 ?
`Context summary:\n${context.map(c => `${c.sender}: ${c.message}`).join('\n')}\n\n` :
'';
const modelResponses = {
llama: `LLaMA 3.2:1B Response:
${contextSummary}Based on your input "${prompt}", I've conducted a comprehensive analysis.
Key insights:
1. This appears to be a complex query requiring deep understanding
2. The context suggests multiple interpretation paths
3. My architecture enables nuanced understanding
Analysis:
- Context relevance: ${context.length ? 'High' : 'None'}
- Complexity level: Advanced
- Suggested approach: Multi-stage analysis
Recommendation: For best results, consider breaking this down into smaller tasks that can be distributed across our model ensemble.`,
gemma: `Gemma 3:1B Response:
${contextSummary}Your query "${prompt}" can be addressed efficiently with these points:
• Processing time: 1.2s
• Context items: ${context.length}
• Key takeaways:
1. [Main point 1]
2. [Supporting fact]
3. [Actionable item]
Note: For deeper analysis, consider using LLaMA 3.2`,
hermes: `Hermes 2 Creative Response:
${contextSummary}Your prompt "${prompt}" inspires this interpretation:
[Creative narrative or poetic response]
Alternative perspectives:
1. [Creative angle 1]
2. [Creative angle 2]
3. [Creative angle 3]
Let me know if you'd like me to elaborate on any of these approaches.`
};
// Special case for clarification requests
if (prompt.includes("Request clarification")) {
return `Clarification Request:
I noticed you asked about "${prompt.replace(/Request clarification for: /, '')}". To provide the best response, could you please:
1. Specify which aspects are most important to you?
2. Provide any additional context or examples?
3. Indicate your preferred response format (bullet points, narrative, etc.)?
This will help me tailor my response to your exact needs.`;
}
return modelResponses[model] || `Response from ${model}: Processed "${prompt}"`;
}
// Display response in chat
function displayResponse(response, model) {
addMessage('ai', response, model);
}
// Create a new task
function createTask(name, queueId = null) {
activeTaskCount++;
const taskId = queueId || Date.now();
const taskDiv = document.createElement('div');
taskDiv.className = 'agent-task';
taskDiv.setAttribute('data-task-id', taskId);
taskDiv.innerHTML = `
<div class="flex justify-between">
<span class="font-medium">${name}</span>
<span class="text-sm text-yellow-400">Pending</span>
</div>
<div class="text-sm text-gray-400 mt-1">Added ${formatTime(new Date())}</div>
<div class="task-progress">
<div class="progress-bar" style="width: 5%"></div>
</div>
`;
activeTasks.prepend(taskDiv);
// Simulate progress updates
if (!queueId) {
let progress = 5;
const interval = setInterval(() => {
progress += Math.random() * 15;
const progressBar = taskDiv.querySelector('.progress-bar');
if (progressBar) progressBar.style.width = `${Math.min(progress, 100)}%`;
if (progress >= 100) {
clearInterval(interval);
const status = taskDiv.querySelector('.text-sm');
if (status) {
status.textContent = "Completed";
status.className = "text-sm text-green-400";
}
}
}, 500);
}
return taskId;
}
// Update task status
function updateTaskStatus(queueId) {
const task = activeTasks.querySelector(`[data-task-id="${queueId}"]`);
if (task) {
const status = task.querySelector('.text-sm');
if (status) {
status.textContent = "Completed";
status.className = "text-sm text-green-400";
}
const progressBar = task.querySelector('.progress-bar');
if (progressBar) progressBar.style.width = "100%";
}
}
// Format time for display
function formatTime(date) {
return date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
}
// Initialize chart
function initChart(canvasId, color) {
const ctx = document.getElementById(canvasId).getContext('2d');
return new Chart(ctx, {
type: 'line',
data: {
labels: Array(10).fill(''),
datasets: [{
data: Array(10).fill(0),
borderColor: color,
borderWidth: 2,
pointRadius: 0,
tension: 0.4,
fill: true,
backgroundColor: `${color}20`
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: { legend: { display: false } },
scales: {
x: { display: false },
y: {
display: false,
min: 0,
max: 100
}
}
}
});
}
// Update chart data
function updateChart(chart, value) {
if (chart.data.datasets[0].data.length >= 10) {
chart.data.datasets[0].data.shift();
}
chart.data.datasets[0].data.push(value);
chart.update();
}
// Update system resources
function updateSystemResources() {
// Update memory usage
memoryUsageValue = 300 + Math.random() * 200;
memoryUsage.textContent = `${Math.round(memoryUsageValue)} MB`;
memoryUsageSmall.textContent = `${Math.round(memoryUsageValue)} MB`;
memoryProgress.style.width = `${Math.min(100, memoryUsageValue / 8)}%`;
// Update charts
updateChart(llamaChart, models.llama.load);
updateChart(gemmaChart, models.gemma.load);
updateChart(hermesChart, models.hermes.load);
updateChart(memoryChart, memoryUsageValue / 8);
// Update load indicators
llamaLoad.textContent = `${Math.round(models.llama.load)}%`;
gemmaLoad.textContent = `${Math.round(models.gemma.load)}%`;
hermesLoad.textContent = `${Math.round(models.hermes.load)}%`;
}
// Update system monitor
function updateSystemMonitor() {
const activeModels = Object.values(models).filter(m => m.isActive).length;
totalModels.textContent = activeModels;
}
});
</script>
<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=MarcRyan/mastermind-comms" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |