File size: 52,794 Bytes
29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 276704d 29c9563 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AutomaForge - AI Agent Creation Platform</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.sidebar {
transition: all 0.3s ease;
}
.block-item {
transition: all 0.2s ease;
user-select: none;
}
.block-item:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.workspace {
background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
background-size: 20px 20px;
position: relative;
overflow: auto;
}
.connection-path {
stroke: #6366f1;
stroke-width: 3;
fill: none;
marker-end: url(#arrowhead);
}
.agent-block {
transition: all 0.3s ease;
position: absolute;
user-select: none;
}
.agent-block:hover {
transform: scale(1.02);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.chat-message {
max-width: 80%;
}
.typing-indicator::after {
content: '...';
animation: typing 1.5s infinite;
display: inline-block;
width: 0;
}
@keyframes typing {
0% { content: '.'; }
33% { content: '..'; }
66% { content: '...'; }
}
.connection-dot {
width: 12px;
height: 12px;
border-radius: 50%;
position: absolute;
cursor: pointer;
z-index: 20;
}
.connection-dot.input {
top: -6px;
left: 50%;
transform: translateX(-50%);
}
.connection-dot.output {
bottom: -6px;
left: 50%;
transform: translateX(-50%);
}
.dragging {
opacity: 0.8;
z-index: 100;
}
.connection-line {
position: absolute;
pointer-events: none;
z-index: 5;
}
</style>
</head>
<body class="bg-gray-50 font-sans text-gray-800">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-indigo-900 text-white w-64 flex-shrink-0 flex flex-col">
<div class="p-4 border-b border-indigo-800 flex items-center">
<div class="bg-white rounded-lg p-2 mr-3">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6 text-indigo-600">
<path fill-rule="evenodd" d="M12.963 2.286a.75.75 0 00-1.071-.136 9.742 9.742 0 00-3.539 6.176 7.547 7.547 0 01-1.705-1.715.75.75 0 00-1.152-.082A9 9 0 1015.68 4.534a7.46 7.46 0 01-2.717-2.248zM15.75 14.25a3.75 3.75 0 11-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 011.925-3.546 3.75 3.75 0 013.255 3.718z" clip-rule="evenodd" />
</svg>
</div>
<h1 class="text-xl font-bold">AutomaForge</h1>
</div>
<div class="p-4 border-b border-indigo-800">
<button id="newAgentBtn" class="w-full bg-indigo-700 hover:bg-indigo-600 text-white py-2 px-4 rounded-lg flex items-center justify-center transition">
<i class="fas fa-plus mr-2"></i> New Agent
</button>
</div>
<div class="flex-1 overflow-y-auto">
<div class="p-4">
<h3 class="text-sm uppercase font-semibold text-indigo-300 mb-2">Recent Agents</h3>
<ul>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<div class="w-3 h-3 rounded-full bg-green-400 mr-3"></div>
<span>Customer Support Bot</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<div class="w-3 h-3 rounded-full bg-yellow-400 mr-3"></div>
<span>Data Analyzer</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<div class="w-3 h-3 rounded-full bg-red-400 mr-3"></div>
<span>Image Processor</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<div class="w-3 h-3 rounded-full bg-green-400 mr-3"></div>
<span>Document Summarizer</span>
</a>
</li>
</ul>
</div>
<div class="p-4 border-t border-indigo-800">
<h3 class="text-sm uppercase font-semibold text-indigo-300 mb-2">Templates</h3>
<ul>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<i class="fas fa-comments mr-3 text-indigo-300"></i>
<span>Chatbot</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<i class="fas fa-chart-line mr-3 text-indigo-300"></i>
<span>Data Analysis</span>
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center p-2 rounded-lg hover:bg-indigo-800 transition">
<i class="fas fa-image mr-3 text-indigo-300"></i>
<span>Image Processing</span>
</a>
</li>
</ul>
</div>
</div>
<div class="p-4 border-t border-indigo-800">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center mr-3">
<i class="fas fa-user text-sm"></i>
</div>
<div>
<div class="font-medium">John Doe</div>
<div class="text-xs text-indigo-300">Admin</div>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Top Navigation -->
<div class="bg-white border-b border-gray-200 p-4 flex items-center justify-between">
<div class="flex items-center">
<button id="toggleSidebar" class="mr-4 text-gray-500 hover:text-gray-700">
<i class="fas fa-bars"></i>
</button>
<h2 class="text-lg font-semibold">Agent Architect</h2>
</div>
<div class="flex items-center space-x-4">
<button class="text-gray-500 hover:text-gray-700">
<i class="fas fa-question-circle"></i>
</button>
<button class="text-gray-500 hover:text-gray-700">
<i class="fas fa-bell"></i>
</button>
<button id="runAgentBtn" class="bg-indigo-600 text-white py-1 px-3 rounded-lg text-sm hover:bg-indigo-700 transition">
<i class="fas fa-play mr-1"></i> Run Agent
</button>
</div>
</div>
<!-- Main Workspace -->
<div class="flex-1 flex overflow-hidden">
<!-- Blocks Library -->
<div class="w-64 bg-white border-r border-gray-200 p-4 overflow-y-auto">
<div class="mb-6">
<h3 class="font-medium text-gray-700 mb-3">Search Blocks</h3>
<div class="relative">
<input type="text" placeholder="Search blocks..." class="w-full pl-8 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="mb-6">
<h3 class="font-medium text-gray-700 mb-3">Categories</h3>
<div class="space-y-2">
<button class="w-full text-left px-3 py-2 rounded-lg bg-indigo-50 text-indigo-700 flex items-center justify-between">
<span>All Blocks</span>
<span class="bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded-full">42</span>
</button>
<button class="w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 flex items-center justify-between">
<span>NLP</span>
<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">12</span>
</button>
<button class="w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 flex items-center justify-between">
<span>Image Processing</span>
<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">8</span>
</button>
<button class="w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 flex items-center justify-between">
<span>API Integration</span>
<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">6</span>
</button>
<button class="w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 flex items-center justify-between">
<span>Data Processing</span>
<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">10</span>
</button>
</div>
</div>
<div>
<h3 class="font-medium text-gray-700 mb-3">Available Blocks</h3>
<div class="space-y-3">
<div class="block-item bg-white border border-gray-200 rounded-lg p-3 cursor-move hover:shadow-md draggable-block" draggable="true" data-type="input" data-color="blue">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2">
<i class="fas fa-comment text-blue-500"></i>
</div>
<div class="font-medium">Text Input</div>
</div>
<p class="text-xs text-gray-500">Accepts user text input for processing</p>
</div>
<div class="block-item bg-white border border-gray-200 rounded-lg p-3 cursor-move hover:shadow-md draggable-block" draggable="true" data-type="llm" data-color="purple">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mr-2">
<i class="fas fa-brain text-purple-500"></i>
</div>
<div class="font-medium">LLM Processor</div>
</div>
<p class="text-xs text-gray-500">Processes text with a large language model</p>
</div>
<div class="block-item bg-white border border-gray-200 rounded-lg p-3 cursor-move hover:shadow-md draggable-block" draggable="true" data-type="knowledge" data-color="green">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-2">
<i class="fas fa-database text-green-500"></i>
</div>
<div class="font-medium">Knowledge Base</div>
</div>
<p class="text-xs text-gray-500">Connects to your knowledge repository</p>
</div>
<div class="block-item bg-white border border-gray-200 rounded-lg p-3 cursor-move hover:shadow-md draggable-block" draggable="true" data-type="api" data-color="yellow">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center mr-2">
<i class="fas fa-code text-yellow-500"></i>
</div>
<div class="font-medium">API Connector</div>
</div>
<p class="text-xs text-gray-500">Connects to external APIs</p>
</div>
<div class="block-item bg-white border border-gray-200 rounded-lg p-3 cursor-move hover:shadow-md draggable-block" draggable="true" data-type="image" data-color="red">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center mr-2">
<i class="fas fa-image text-red-500"></i>
</div>
<div class="font-medium">Image Analyzer</div>
</div>
<p class="text-xs text-gray-500">Analyzes and processes images</p>
</div>
</div>
</div>
</div>
<!-- Agent Workspace -->
<div id="workspace" class="flex-1 bg-gray-50 workspace overflow-auto relative">
<svg id="connections-svg" class="absolute top-0 left-0 w-full h-full pointer-events-none" style="z-index: 0;">
<defs>
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#6366f1" />
</marker>
</defs>
</svg>
<div class="p-6">
<div class="max-w-4xl mx-auto">
<div id="agent-description" class="bg-white rounded-xl shadow-sm p-6 mb-6">
<h3 class="text-lg font-semibold mb-4">Agent Architect</h3>
<p class="text-gray-600 mb-4">Describe what you want your AI agent to do in natural language, and Agent Architect will automatically generate the workflow.</p>
<div class="relative">
<textarea id="agent-description-input" class="w-full border border-gray-300 rounded-lg p-4 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" rows="4" placeholder="Example: Create a customer support chatbot that can answer questions about our products, check order status, and escalate to human support when needed..."></textarea>
<button id="generate-btn" class="absolute bottom-4 right-4 bg-indigo-600 text-white p-2 rounded-lg hover:bg-indigo-700 transition">
<i class="fas fa-magic"></i> Generate
</button>
</div>
</div>
<div class="flex justify-center mb-6">
<div class="flex items-center space-x-4">
<button id="add-layer-btn" class="bg-white border border-gray-300 rounded-lg px-4 py-2 flex items-center hover:bg-gray-50">
<i class="fas fa-layer-group mr-2 text-indigo-500"></i>
<span>Add Layer</span>
</button>
<button id="auto-connect-btn" class="bg-white border border-gray-300 rounded-lg px-4 py-2 flex items-center hover:bg-gray-50">
<i class="fas fa-robot mr-2 text-indigo-500"></i>
<span>Auto-Connect</span>
</button>
<button id="optimize-btn" class="bg-white border border-gray-300 rounded-lg px-4 py-2 flex items-center hover:bg-gray-50">
<i class="fas fa-bolt mr-2 text-indigo-500"></i>
<span>Optimize</span>
</button>
</div>
</div>
<!-- Predefined blocks for demo -->
<div id="blocks-container">
<div class="agent-block bg-white rounded-xl shadow-sm p-4 border-2 border-blue-200" style="transform: translate(200px, 150px);" data-id="block-1" data-type="input">
<div class="absolute -top-2 -right-2 bg-blue-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs">
<i class="fas fa-play"></i>
</div>
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2">
<i class="fas fa-comment text-blue-500"></i>
</div>
<div class="font-medium">User Input</div>
</div>
<p class="text-xs text-gray-500 mb-3">Accepts user questions</p>
<div class="text-xs text-gray-400">Output: <span class="text-gray-600">User query text</span></div>
<div class="connection-dot output bg-blue-500" data-type="output" data-block-id="block-1"></div>
</div>
<div class="agent-block bg-white rounded-xl shadow-sm p-4 border-2 border-purple-200" style="transform: translate(500px, 250px);" data-id="block-2" data-type="llm">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mr-2">
<i class="fas fa-brain text-purple-500"></i>
</div>
<div class="font-medium">LLM Processor</div>
</div>
<p class="text-xs text-gray-500 mb-3">Processes user query with GPT-4</p>
<div class="text-xs text-gray-400 mb-1">Input: <span class="text-gray-600">User query text</span></div>
<div class="text-xs text-gray-400">Output: <span class="text-gray-600">Processed response</span></div>
<div class="connection-dot input bg-purple-500" data-type="input" data-block-id="block-2"></div>
<div class="connection-dot output bg-purple-500" data-type="output" data-block-id="block-2"></div>
</div>
<div class="agent-block bg-white rounded-xl shadow-sm p-4 border-2 border-green-200" style="transform: translate(800px, 350px);" data-id="block-3" data-type="output">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-2">
<i class="fas fa-comments text-green-500"></i>
</div>
<div class="font-medium">Response Output</div>
</div>
<p class="text-xs text-gray-500 mb-3">Returns response to user</p>
<div class="text-xs text-gray-400">Input: <span class="text-gray-600">Processed response</span></div>
<div class="connection-dot input bg-green-500" data-type="input" data-block-id="block-3"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Right Panel - Configuration and Testing -->
<div class="w-80 bg-white border-l border-gray-200 flex flex-col">
<div class="border-b border-gray-200 p-4">
<div class="flex space-x-2">
<button id="config-tab" class="flex-1 py-2 px-3 rounded-lg bg-indigo-600 text-white text-sm font-medium">
Configuration
</button>
<button id="test-tab" class="flex-1 py-2 px-3 rounded-lg bg-white border border-gray-200 text-sm font-medium hover:bg-gray-50">
Testing
</button>
</div>
</div>
<div id="config-panel" class="flex-1 overflow-y-auto p-4">
<div class="mb-6">
<h3 class="font-medium text-gray-700 mb-3">Selected Block</h3>
<div id="block-config" class="bg-gray-50 rounded-lg p-4 border border-gray-200">
<div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
<i class="fas fa-brain text-purple-500"></i>
</div>
<div>
<div class="font-medium">LLM Processor</div>
<div class="text-xs text-gray-500">Processes text with a large language model</div>
</div>
</div>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Model</label>
<select id="llm-model" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-sm">
<option>GPT-4</option>
<option>GPT-3.5</option>
<option>Claude-2</option>
<option>Llama 2</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Temperature</label>
<input id="temperature" type="range" min="0" max="1" step="0.1" value="0.7" class="w-full">
<div class="flex justify-between text-xs text-gray-500 mt-1">
<span>Precise</span>
<span>Creative</span>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Max Tokens</label>
<input id="max-tokens" type="number" value="1000" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">System Prompt</label>
<textarea id="system-prompt" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-sm" rows="3">You are a helpful customer support assistant...</textarea>
</div>
</div>
</div>
</div>
<div>
<h3 class="font-medium text-gray-700 mb-3">Optimization Suggestions</h3>
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
<div class="flex items-start mb-3">
<div class="flex-shrink-0 mt-1">
<i class="fas fa-lightbulb text-yellow-500"></i>
</div>
<div class="ml-3">
<h4 class="text-sm font-medium text-yellow-800">Add Knowledge Base</h4>
<p class="text-xs text-yellow-700">Consider connecting a knowledge base to improve response accuracy.</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 mt-1">
<i class="fas fa-lightbulb text-yellow-500"></i>
</div>
<div class="ml-3">
<h4 class="text-sm font-medium text-yellow-800">Add Sentiment Analysis</h4>
<p class="text-xs text-yellow-700">Adding sentiment analysis could help route frustrated customers to human support.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Testing Chat Panel -->
<div id="test-panel" class="border-t border-gray-200 p-4 bg-gray-50 hidden">
<h3 class="font-medium text-gray-700 mb-3">Test Agent</h3>
<div id="chat-container" class="bg-white rounded-lg border border-gray-200 mb-3" style="height: 200px; overflow-y: auto;">
<div class="p-3 space-y-3">
<div class="chat-message bg-blue-50 rounded-lg p-3 ml-auto">
<div class="text-xs text-gray-500 mb-1 text-right">You</div>
<p class="text-sm">How can I track my order?</p>
</div>
<div class="chat-message bg-gray-100 rounded-lg p-3">
<div class="text-xs text-gray-500 mb-1">Agent</div>
<p class="text-sm">You can track your order by visiting the order status page...</p>
</div>
<div class="chat-message bg-blue-50 rounded-lg p-3 ml-auto">
<div class="text-xs text-gray-500 mb-1 text-right">You</div>
<p class="text-sm">What's your return policy?</p>
</div>
<div id="typing-indicator" class="chat-message bg-gray-100 rounded-lg p-3">
<div class="text-xs text-gray-500 mb-1">Agent</div>
<p class="text-sm typing-indicator"></p>
</div>
</div>
</div>
<div class="relative">
<input id="chat-input" type="text" placeholder="Type a message to test..." class="w-full border border-gray-300 rounded-lg pl-4 pr-10 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
<button id="send-chat-btn" class="absolute right-2 top-2 text-indigo-600 hover:text-indigo-800">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// DOM elements
const workspace = document.getElementById('workspace');
const blocksContainer = document.getElementById('blocks-container');
const draggableBlocks = document.querySelectorAll('.draggable-block');
const agentBlocks = document.querySelectorAll('.agent-block');
const connectionDots = document.querySelectorAll('.connection-dot');
const connectionsSvg = document.getElementById('connections-svg');
const toggleSidebar = document.getElementById('toggleSidebar');
const sidebar = document.querySelector('.sidebar');
const configTab = document.getElementById('config-tab');
const testTab = document.getElementById('test-tab');
const configPanel = document.getElementById('config-panel');
const testPanel = document.getElementById('test-panel');
const generateBtn = document.getElementById('generate-btn');
const agentDescriptionInput = document.getElementById('agent-description-input');
const runAgentBtn = document.getElementById('runAgentBtn');
const chatInput = document.getElementById('chat-input');
const sendChatBtn = document.getElementById('send-chat-btn');
const chatContainer = document.getElementById('chat-container');
const typingIndicator = document.getElementById('typing-indicator');
// State variables
let isDragging = false;
let currentBlock = null;
let startX, startY;
let initialX, initialY;
let connections = [];
let isConnecting = false;
let startDot = null;
// Initialize the app
init();
function init() {
setupEventListeners();
drawConnections();
simulateTyping();
}
function setupEventListeners() {
// Toggle sidebar
toggleSidebar.addEventListener('click', () => {
sidebar.classList.toggle('hidden');
});
// Tab switching
configTab.addEventListener('click', () => {
configTab.classList.add('bg-indigo-600', 'text-white');
configTab.classList.remove('bg-white', 'border', 'border-gray-200');
testTab.classList.remove('bg-indigo-600', 'text-white');
testTab.classList.add('bg-white', 'border', 'border-gray-200');
configPanel.classList.remove('hidden');
testPanel.classList.add('hidden');
});
testTab.addEventListener('click', () => {
testTab.classList.add('bg-indigo-600', 'text-white');
testTab.classList.remove('bg-white', 'border', 'border-gray-200');
configTab.classList.remove('bg-indigo-600', 'text-white');
configTab.classList.add('bg-white', 'border', 'border-gray-200');
testPanel.classList.remove('hidden');
configPanel.classList.add('hidden');
});
// Generate agent from description
generateBtn.addEventListener('click', generateAgentFromDescription);
// Run agent
runAgentBtn.addEventListener('click', runAgent);
// Send chat message
sendChatBtn.addEventListener('click', sendChatMessage);
chatInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
// Make library blocks draggable
draggableBlocks.forEach(block => {
block.addEventListener('dragstart', handleDragStart);
});
// Make workspace droppable
workspace.addEventListener('dragover', handleDragOver);
workspace.addEventListener('drop', handleDrop);
// Make agent blocks draggable
agentBlocks.forEach(block => {
block.addEventListener('mousedown', startDrag);
});
// Make connection dots interactive
connectionDots.forEach(dot => {
dot.addEventListener('mousedown', startConnection);
dot.addEventListener('mouseup', endConnection);
});
// Handle window resize
window.addEventListener('resize', drawConnections);
}
function handleDragStart(e) {
e.dataTransfer.setData('text/plain', e.target.outerHTML);
e.dataTransfer.setData('block-type', e.target.dataset.type);
e.dataTransfer.setData('block-color', e.target.dataset.color);
e.dataTransfer.effectAllowed = 'copy';
}
function handleDragOver(e) {
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
}
function handleDrop(e) {
e.preventDefault();
const html = e.dataTransfer.getData('text/plain');
const type = e.dataTransfer.getData('block-type');
const color = e.dataTransfer.getData('block-color');
const rect = workspace.getBoundingClientRect();
const x = e.clientX - rect.left - 100;
const y = e.clientY - rect.top - 50;
const newBlock = createBlock(html, type, color, x, y);
blocksContainer.appendChild(newBlock);
// Add event listeners to the new block
newBlock.addEventListener('mousedown', startDrag);
// Add connection dots if needed
addConnectionDots(newBlock);
}
function createBlock(html, type, color, x, y) {
const block = document.createElement('div');
block.className = `agent-block bg-white rounded-xl shadow-sm p-4 border-2 border-${color}-200 absolute cursor-move`;
block.style.left = `${x}px`;
block.style.top = `${y}px`;
block.dataset.type = type;
block.dataset.id = `block-${Date.now()}`;
block.innerHTML = html;
// Add connection dots based on block type
if (type !== 'output') {
const outputDot = document.createElement('div');
outputDot.className = `connection-dot output bg-${color}-500`;
outputDot.dataset.type = 'output';
outputDot.dataset.blockId = block.dataset.id;
block.appendChild(outputDot);
}
if (type !== 'input') {
const inputDot = document.createElement('div');
inputDot.className = `connection-dot input bg-${color}-500`;
inputDot.dataset.type = 'input';
inputDot.dataset.blockId = block.dataset.id;
block.appendChild(inputDot);
}
return block;
}
function startDrag(e) {
if (e.target.classList.contains('connection-dot')) return;
isDragging = true;
currentBlock = e.currentTarget;
startX = e.clientX;
startY = e.clientY;
initialX = currentBlock.offsetLeft;
initialY = currentBlock.offsetTop;
currentBlock.classList.add('dragging');
document.addEventListener('mousemove', drag);
document.addEventListener('mouseup', stopDrag);
}
function drag(e) {
if (!isDragging) return;
const dx = e.clientX - startX;
const dy = e.clientY - startY;
currentBlock.style.left = `${initialX + dx}px`;
currentBlock.style.top = `${initialY + dy}px`;
drawConnections();
}
function stopDrag() {
isDragging = false;
if (currentBlock) {
currentBlock.classList.remove('dragging');
currentBlock = null;
}
document.removeEventListener('mousemove', drag);
document.removeEventListener('mouseup', stopDrag);
}
function addConnectionDots(block) {
const dots = block.querySelectorAll('.connection-dot');
dots.forEach(dot => {
dot.addEventListener('mousedown', startConnection);
dot.addEventListener('mouseup', endConnection);
});
}
function startConnection(e) {
e.stopPropagation();
isConnecting = true;
startDot = e.target;
// Create a temporary connection line
const tempLine = document.createElement('div');
tempLine.className = 'connection-line';
tempLine.id = 'temp-connection';
workspace.appendChild(tempLine);
document.addEventListener('mousemove', drawTempConnection);
document.addEventListener('mouseup', stopConnection);
}
function drawTempConnection(e) {
if (!isConnecting) return;
const startRect = startDot.getBoundingClientRect();
const workspaceRect = workspace.getBoundingClientRect();
const startX = startRect.left - workspaceRect.left + startRect.width / 2;
const startY = startRect.top - workspaceRect.top + startRect.height / 2;
const endX = e.clientX - workspaceRect.left;
const endY = e.clientY - workspaceRect.top;
const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
const angle = Math.atan2(endY - startY, endX - startX) * 180 / Math.PI;
const tempLine = document.getElementById('temp-connection');
tempLine.style.width = `${length}px`;
tempLine.style.height = '2px';
tempLine.style.backgroundColor = '#6366f1';
tempLine.style.left = `${startX}px`;
tempLine.style.top = `${startY}px`;
tempLine.style.transform = `rotate(${angle}deg)`;
tempLine.style.transformOrigin = '0 0';
}
function endConnection(e) {
if (!isConnecting) return;
const endDot = e.target;
// Check if we're connecting to a valid dot
if (endDot.classList.contains('connection-dot') &&
endDot !== startDot &&
((startDot.dataset.type === 'output' && endDot.dataset.type === 'input') ||
(startDot.dataset.type === 'input' && endDot.dataset.type === 'output'))) {
// Create a new connection
const connection = {
from: startDot.dataset.blockId,
fromType: startDot.dataset.type,
to: endDot.dataset.blockId,
toType: endDot.dataset.type
};
connections.push(connection);
drawConnections();
}
// Clean up
const tempLine = document.getElementById('temp-connection');
if (tempLine) {
tempLine.remove();
}
isConnecting = false;
startDot = null;
document.removeEventListener('mousemove', drawTempConnection);
document.removeEventListener('mouseup', stopConnection);
}
function stopConnection() {
isConnecting = false;
const tempLine = document.getElementById('temp-connection');
if (tempLine) {
tempLine.remove();
}
document.removeEventListener('mousemove', drawTempConnection);
document.removeEventListener('mouseup', stopConnection);
}
function drawConnections() {
// Clear existing connections
while (connectionsSvg.firstChild) {
connectionsSvg.removeChild(connectionsSvg.firstChild);
}
// Redraw all connections
connections.forEach(conn => {
const fromBlock = document.querySelector(`[data-id="${conn.from}"]`);
const toBlock = document.querySelector(`[data-id="${conn.to}"]`);
if (fromBlock && toBlock) {
const fromRect = fromBlock.getBoundingClientRect();
const toRect = toBlock.getBoundingClientRect();
const workspaceRect = workspace.getBoundingClientRect();
const fromX = fromRect.left - workspaceRect.left + fromRect.width / 2;
const fromY = fromRect.bottom - workspaceRect.top;
const toX = toRect.left - workspaceRect.left + toRect.width / 2;
const toY = toRect.top - workspaceRect.top;
// Create a curved path
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
path.setAttribute('class', 'connection-path');
path.setAttribute('d', `M${fromX},${fromY} C${fromX},${fromY + 100} ${toX},${toY - 100} ${toX},${toY}`);
connectionsSvg.appendChild(path);
}
});
}
function generateAgentFromDescription() {
const description = agentDescriptionInput.value.trim();
if (!description) return;
// In a real app, this would call an API to generate the agent
// For demo, we'll just show a success message
alert('Agent workflow generated based on your description!');
// Simulate adding some blocks
if (blocksContainer.children.length <= 3) {
const newBlock = createBlock(
`<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center mr-2">
<i class="fas fa-code text-yellow-500"></i>
</div>
<div class="font-medium">API Connector</div>
</div>
<p class="text-xs text-gray-500 mb-3">Connects to external APIs</p>
<div class="text-xs text-gray-400">Input: <span class="text-gray-600">User query</span></div>
<div class="text-xs text-gray-400">Output: <span class="text-gray-600">API response</span></div>`,
'api',
'yellow',
600,
400
);
blocksContainer.appendChild(newBlock);
addConnectionDots(newBlock);
// Add a connection to the LLM block
connections.push({
from: 'block-2',
fromType: 'output',
to: newBlock.dataset.id,
toType: 'input'
});
drawConnections();
}
}
function runAgent() {
alert('Agent is running! Check the testing panel to interact with it.');
testTab.click();
}
function sendChatMessage() {
const message = chatInput.value.trim();
if (!message) return;
// Add user message
const userMessage = document.createElement('div');
userMessage.className = 'chat-message bg-blue-50 rounded-lg p-3 ml-auto';
userMessage.innerHTML = `
<div class="text-xs text-gray-500 mb-1 text-right">You</div>
<p class="text-sm">${message}</p>
`;
chatContainer.appendChild(userMessage);
// Clear input
chatInput.value = '';
// Show typing indicator
typingIndicator.style.display = 'block';
typingIndicator.querySelector('p').className = 'text-sm typing-indicator';
// Simulate agent response after a delay
setTimeout(() => {
typingIndicator.style.display = 'none';
const responses = [
"I can help with that. Our standard return policy allows returns within 30 days of purchase.",
"For order tracking, please visit our order status page and enter your order number.",
"Our customer support team is available 24/7 to assist you with any issues.",
"You can find more information about our products in the documentation section."
];
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
const agentMessage = document.createElement('div');
agentMessage.className = 'chat-message bg-gray-100 rounded-lg p-3';
agentMessage.innerHTML = `
<div class="text-xs text-gray-500 mb-1">Agent</div>
<p class="text-sm">${randomResponse}</p>
`;
chatContainer.appendChild(agentMessage);
// Scroll to bottom
chatContainer.scrollTop = chatContainer.scrollHeight;
}, 1500);
}
function simulateTyping() {
setTimeout(() => {
typingIndicator.style.display = 'none';
const agentMessage = document.createElement('div');
agentMessage.className = 'chat-message bg-gray-100 rounded-lg p-3';
agentMessage.innerHTML = `
<div class="text-xs text-gray-500 mb-1">Agent</div>
<p class="text-sm">Our return policy allows returns within 30 days of purchase. Items must be in original condition with tags attached. Would you like me to provide more details?</p>
`;
chatContainer.appendChild(agentMessage);
}, 2000);
}
});
</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=adowu/awwagent" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html> |