Spaces:
Running
Running
File size: 53,683 Bytes
9b1edc0 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chatbot Node Management System</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>
.node-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.sidebar {
transition: all 0.3s ease;
}
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
position: fixed;
z-index: 50;
height: 100vh;
}
.sidebar.active {
transform: translateX(0);
}
}
.connection-line {
position: relative;
}
.connection-line::after {
content: '';
position: absolute;
top: 50%;
left: -20px;
width: 15px;
height: 2px;
background-color: #3b82f6;
}
</style>
</head>
<body class="bg-gray-50">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-white w-64 border-r border-gray-200 flex flex-col">
<div class="p-4 border-b border-gray-200">
<h1 class="text-xl font-bold text-blue-600 flex items-center">
<i class="fas fa-robot mr-2"></i> ChatNode Manager
</h1>
</div>
<div class="flex-1 overflow-y-auto">
<div class="p-4">
<button id="createNodeBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg flex items-center justify-center">
<i class="fas fa-plus mr-2"></i> Create New Node
</button>
</div>
<div class="px-4">
<h3 class="text-sm font-semibold text-gray-500 uppercase tracking-wider">Your Nodes</h3>
<div id="nodeList" class="mt-2 space-y-1">
<!-- Nodes will be added here dynamically -->
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center">
<i class="fas fa-user text-blue-600"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Admin User</p>
<p class="text-xs text-gray-500">admin@chatnode.com</p>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Top Navigation -->
<header class="bg-white border-b border-gray-200 flex items-center justify-between p-4">
<button id="sidebarToggle" class="md:hidden text-gray-500">
<i class="fas fa-bars text-xl"></i>
</button>
<div class="flex items-center space-x-4">
<div class="relative">
<input type="text" placeholder="Search nodes..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<button class="p-2 text-gray-500 hover:text-gray-700">
<i class="fas fa-bell"></i>
</button>
</div>
</header>
<!-- Content Area -->
<main class="flex-1 overflow-y-auto p-6 bg-gray-50">
<!-- Dashboard View -->
<div id="dashboardView">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold text-gray-800">Chatbot Nodes Dashboard</h2>
<div class="flex space-x-2">
<button class="px-3 py-1 border border-gray-300 rounded-lg text-sm flex items-center">
<i class="fas fa-filter mr-1"></i> Filter
</button>
<button class="px-3 py-1 border border-gray-300 rounded-lg text-sm flex items-center">
<i class="fas fa-sort mr-1"></i> Sort
</button>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Node cards will be added here dynamically -->
<div class="node-card bg-white p-6 rounded-xl shadow-md border border-gray-200 transition-all duration-300 cursor-pointer" onclick="showNodeDetail('customer-support')">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">Customer Support</h3>
<p class="text-sm text-gray-500 mt-1">Handles customer inquiries</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Active</span>
</div>
<div class="mt-4 flex items-center text-sm text-gray-500">
<i class="fas fa-plug mr-1 text-blue-500"></i>
<span>Connected to MySQL</span>
</div>
<div class="mt-2 flex items-center text-sm text-gray-500">
<i class="fas fa-brain mr-1 text-purple-500"></i>
<span>GPT-4</span>
</div>
<div class="mt-4 pt-4 border-t border-gray-100 flex justify-between items-center">
<span class="text-xs text-gray-400">Last updated: 2 hours ago</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">Manage</button>
</div>
</div>
<div class="node-card bg-white p-6 rounded-xl shadow-md border border-gray-200 transition-all duration-300 cursor-pointer" onclick="showNodeDetail('hr-assistant')">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">HR Assistant</h3>
<p class="text-sm text-gray-500 mt-1">Answers HR policies questions</p>
</div>
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">Draft</span>
</div>
<div class="mt-4 flex items-center text-sm text-gray-500">
<i class="fas fa-file-alt mr-1 text-blue-500"></i>
<span>Connected to PDF files</span>
</div>
<div class="mt-2 flex items-center text-sm text-gray-500">
<i class="fas fa-brain mr-1 text-purple-500"></i>
<span>Gemini Pro</span>
</div>
<div class="mt-4 pt-4 border-t border-gray-100 flex justify-between items-center">
<span class="text-xs text-gray-400">Last updated: 1 day ago</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">Manage</button>
</div>
</div>
<div class="node-card bg-white p-6 rounded-xl shadow-md border border-gray-200 transition-all duration-300 cursor-pointer" onclick="showNodeDetail('tech-support')">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">Tech Support</h3>
<p class="text-sm text-gray-500 mt-1">Technical troubleshooting</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Active</span>
</div>
<div class="mt-4 flex items-center text-sm text-gray-500">
<i class="fas fa-database mr-1 text-blue-500"></i>
<span>Connected to MongoDB</span>
</div>
<div class="mt-2 flex items-center text-sm text-gray-500">
<i class="fas fa-brain mr-1 text-purple-500"></i>
<span>Llama 2</span>
</div>
<div class="mt-4 pt-4 border-t border-gray-100 flex justify-between items-center">
<span class="text-xs text-gray-400">Last updated: 30 minutes ago</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">Manage</button>
</div>
</div>
</div>
</div>
<!-- Node Detail View (hidden by default) -->
<div id="nodeDetailView" class="hidden">
<div class="mb-6 flex justify-between items-center">
<button onclick="showDashboard()" class="flex items-center text-blue-600 hover:text-blue-800">
<i class="fas fa-arrow-left mr-2"></i> Back to Dashboard
</button>
<div class="flex space-x-2">
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
<i class="fas fa-save mr-2"></i> Save Changes
</button>
<button onclick="showExportOptions()" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700">
<i class="fas fa-download mr-2"></i> Export
</button>
<button class="px-4 py-2 bg-red-100 text-red-600 rounded-lg hover:bg-red-200">
<i class="fas fa-trash mr-2"></i> Delete Node
</button>
</div>
</div>
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="p-6 border-b border-gray-200">
<div class="flex justify-between items-start">
<div>
<h2 id="nodeDetailTitle" class="text-2xl font-bold text-gray-800">Customer Support</h2>
<p class="text-gray-600 mt-1">Node ID: <span id="nodeDetailId" class="font-mono">customer-support</span></p>
</div>
<div class="flex items-center space-x-2">
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Active</span>
<button class="p-2 text-gray-500 hover:text-gray-700">
<i class="fas fa-cog"></i>
</button>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 p-6">
<!-- Node Configuration -->
<div class="lg:col-span-2 space-y-6">
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-sliders-h mr-2 text-blue-500"></i> Node Configuration
</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Node Name</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" value="Customer Support">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<textarea class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" rows="2">Handles customer inquiries and support tickets</textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option>Active</option>
<option>Inactive</option>
<option>Draft</option>
<option>Maintenance</option>
</select>
</div>
</div>
</div>
<!-- Data Source Configuration -->
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-database mr-2 text-blue-500"></i> Data Source
</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Source Type</label>
<div class="flex space-x-4">
<label class="inline-flex items-center">
<input type="radio" name="sourceType" class="h-4 w-4 text-blue-600" checked>
<span class="ml-2 text-gray-700">Database</span>
</label>
<label class="inline-flex items-center">
<input type="radio" name="sourceType" class="h-4 w-4 text-blue-600">
<span class="ml-2 text-gray-700">Document Files</span>
</label>
<label class="inline-flex items-center">
<input type="radio" name="sourceType" class="h-4 w-4 text-blue-600">
<span class="ml-2 text-gray-700">API</span>
</label>
</div>
</div>
<div id="databaseConfig">
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Database Type</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option>MySQL</option>
<option>PostgreSQL</option>
<option>MongoDB</option>
<option>SQL Server</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Connection String</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" value="mysql://user:pass@localhost:3306/customer_db">
</div>
</div>
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Tables/Collections</label>
<div class="flex flex-wrap gap-2">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">customers</span>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">tickets</span>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">products</span>
<button class="text-blue-600 hover:text-blue-800">
<i class="fas fa-plus"></i>
</button>
</div>
</div>
</div>
<div id="documentConfig" class="hidden">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Upload Documents</label>
<div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-lg">
<div class="space-y-1 text-center">
<div class="flex text-sm text-gray-600">
<label class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none">
<span>Upload files</span>
<input type="file" class="sr-only" multiple>
</label>
<p class="pl-1">or drag and drop</p>
</div>
<p class="text-xs text-gray-500">PDF, DOCX, TXT up to 10MB</p>
</div>
</div>
</div>
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Uploaded Files</label>
<ul class="divide-y divide-gray-200">
<li class="py-3 flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-file-pdf text-red-500 mr-2"></i>
<span>customer_manual.pdf</span>
</div>
<button class="text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</li>
<li class="py-3 flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-file-word text-blue-500 mr-2"></i>
<span>faq.docx</span>
</div>
<button class="text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- LLM Configuration -->
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-brain mr-2 text-purple-500"></i> Language Model
</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Model Provider</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option>OpenAI</option>
<option>Google Gemini</option>
<option>Anthropic Claude</option>
<option>Meta Llama</option>
<option>Ollama</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Model</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option>GPT-4</option>
<option>GPT-3.5 Turbo</option>
<option>GPT-4 Turbo</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">API Key</label>
<div class="relative">
<input type="password" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 pr-10" value="sk-123...456">
<button class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-500 hover:text-gray-700">
<i class="far fa-eye"></i>
</button>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Temperature</label>
<input type="range" min="0" max="1" step="0.1" value="0.7" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
<div class="flex justify-between text-xs text-gray-500">
<span>Precise</span>
<span>Balanced</span>
<span>Creative</span>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">System Prompt</label>
<textarea class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" rows="4">You are a helpful customer support assistant for our company. Be polite, professional, and try to resolve customer issues efficiently. If you don't know the answer, escalate to human support.</textarea>
</div>
</div>
</div>
</div>
<!-- Node Connections -->
<div class="space-y-6">
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-project-diagram mr-2 text-green-500"></i> Node Connections
</h3>
<div class="space-y-3">
<div class="connection-line">
<div class="bg-white p-3 rounded-lg border border-gray-200 shadow-sm">
<div class="flex justify-between items-start">
<div>
<h4 class="font-medium">HR Assistant</h4>
<p class="text-xs text-gray-500">For HR policy questions</p>
</div>
<span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full">Active</span>
</div>
</div>
</div>
<div class="connection-line">
<div class="bg-white p-3 rounded-lg border border-gray-200 shadow-sm">
<div class="flex justify-between items-start">
<div>
<h4 class="font-medium">Tech Support</h4>
<p class="text-xs text-gray-500">Technical issues</p>
</div>
<span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full">Active</span>
</div>
</div>
</div>
<button class="w-full mt-2 px-3 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg flex items-center justify-center">
<i class="fas fa-plus mr-2"></i> Add Connection
</button>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-chart-line mr-2 text-yellow-500"></i> Node Analytics
</h3>
<div class="space-y-4">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium">Daily Interactions</span>
<span class="text-blue-600">1,245</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-600 h-2 rounded-full" style="width: 75%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium">Success Rate</span>
<span class="text-green-600">89%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-600 h-2 rounded-full" style="width: 89%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="font-medium">Escalation Rate</span>
<span class="text-red-600">11%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-red-600 h-2 rounded-full" style="width: 11%"></div>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-semibold text-lg mb-4 flex items-center">
<i class="fas fa-bolt mr-2 text-purple-500"></i> Quick Actions
</h3>
<div class="grid grid-cols-2 gap-2">
<button class="p-3 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 flex flex-col items-center">
<i class="fas fa-play text-green-500 mb-1"></i>
<span class="text-xs">Test Node</span>
</button>
<button class="p-3 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 flex flex-col items-center">
<i class="fas fa-sync-alt text-blue-500 mb-1"></i>
<span class="text-xs">Refresh Data</span>
</button>
<button class="p-3 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 flex flex-col items-center">
<i class="fas fa-history text-yellow-500 mb-1"></i>
<span class="text-xs">View Logs</span>
</button>
<button class="p-3 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 flex flex-col items-center">
<i class="fas fa-share-alt text-purple-500 mb-1"></i>
<span class="text-xs">Share</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Export Options Modal -->
<div id="exportOptionsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="p-6 border-b border-gray-200">
<h3 class="text-xl font-bold text-gray-800 flex items-center">
<i class="fas fa-download mr-2 text-green-500"></i> Export Options
</h3>
</div>
<div class="p-6 space-y-6">
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-semibold text-lg mb-3 flex items-center">
<i class="fas fa-code mr-2 text-blue-500"></i> Embed in Website
</h4>
<p class="text-sm text-gray-600 mb-3">Copy this code to embed the chatbot in your website:</p>
<div class="relative">
<pre id="embedCode" class="bg-gray-800 text-gray-100 p-3 rounded-lg text-sm overflow-x-auto">
<script src="https://yourdomain.com/chatbot.js?id=<span id="nodeIdForEmbed"></span>"></script>
<div id="chatbot-container"></div>
<style>
#chatbot-container {
position: fixed;
bottom: 20px;
right: 20px;
width: 350px;
height: 500px;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
</style></pre>
<button onclick="copyToClipboard('embedCode')" class="absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded text-sm">
<i class="fas fa-copy mr-1"></i> Copy
</button>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-semibold text-lg mb-3 flex items-center">
<i class="fas fa-plug mr-2 text-purple-500"></i> API Integration
</h4>
<p class="text-sm text-gray-600 mb-3">Use these API endpoints to integrate with your application:</p>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Base URL</label>
<div class="relative">
<pre class="bg-gray-800 text-gray-100 p-3 rounded-lg text-sm overflow-x-auto">https://api.yourdomain.com/v1/nodes/<span id="nodeIdForApi"></span></pre>
<button onclick="copyToClipboard(this.previousElementSibling)" class="absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded text-sm">
<i class="fas fa-copy mr-1"></i> Copy
</button>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Example Request</label>
<div class="relative">
<pre class="bg-gray-800 text-gray-100 p-3 rounded-lg text-sm overflow-x-auto">
POST /messages
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
{
"message": "Hello, how can I help you?",
"context": {}
}</pre>
<button onclick="copyToClipboard(this.previousElementSibling)" class="absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded text-sm">
<i class="fas fa-copy mr-1"></i> Copy
</button>
</div>
</div>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200 flex justify-end">
<button onclick="document.getElementById('exportOptionsModal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
Close
</button>
</div>
</div>
</div>
<!-- Create Node Modal -->
<div id="createNodeModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="p-6 border-b border-gray-200">
<h3 class="text-xl font-bold text-gray-800 flex items-center">
<i class="fas fa-plus-circle mr-2 text-blue-500"></i> Create New Chatbot Node
</h3>
</div>
<div class="p-6 space-y-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Node Name</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g., Customer Support Bot">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<textarea class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" rows="2" placeholder="Brief description of this chatbot's purpose"></textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Data Source</label>
<div class="grid grid-cols-1 md:grid-cols-3 gap-3 mt-2">
<div class="data-source-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all">
<div class="flex flex-col items-center text-center">
<i class="fas fa-database text-3xl text-blue-500 mb-2"></i>
<h4 class="font-medium">Database</h4>
<p class="text-xs text-gray-500 mt-1">Connect to SQL or NoSQL databases</p>
</div>
</div>
<div class="data-source-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all">
<div class="flex flex-col items-center text-center">
<i class="fas fa-file-alt text-3xl text-blue-500 mb-2"></i>
<h4 class="font-medium">Documents</h4>
<p class="text-xs text-gray-500 mt-1">Upload PDFs, Word, or text files</p>
</div>
</div>
<div class="data-source-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all">
<div class="flex flex-col items-center text-center">
<i class="fas fa-plug text-3xl text-blue-500 mb-2"></i>
<h4 class="font-medium">API</h4>
<p class="text-xs text-gray-500 mt-1">Connect to external APIs</p>
</div>
</div>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Language Model</label>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 mt-2">
<div class="llm-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-purple-500 hover:bg-purple-50 transition-all">
<div class="flex items-center">
<i class="fas fa-robot text-2xl text-purple-500 mr-3"></i>
<div>
<h4 class="font-medium">OpenAI</h4>
<p class="text-xs text-gray-500">GPT-4, GPT-3.5 Turbo</p>
</div>
</div>
</div>
<div class="llm-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-purple-500 hover:bg-purple-50 transition-all">
<div class="flex items-center">
<i class="fab fa-google text-2xl text-purple-500 mr-3"></i>
<div>
<h4 class="font-medium">Google Gemini</h4>
<p class="text-xs text-gray-500">Gemini Pro, Gemini Ultra</p>
</div>
</div>
</div>
<div class="llm-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-purple-500 hover:bg-purple-50 transition-all">
<div class="flex items-center">
<i class="fas fa-server text-2xl text-purple-500 mr-3"></i>
<div>
<h4 class="font-medium">Ollama</h4>
<p class="text-xs text-gray-500">Run models locally</p>
</div>
</div>
</div>
<div class="llm-option border border-gray-200 rounded-lg p-4 cursor-pointer hover:border-purple-500 hover:bg-purple-50 transition-all">
<div class="flex items-center">
<i class="fas fa-cube text-2xl text-purple-500 mr-3"></i>
<div>
<h4 class="font-medium">Meta Llama</h4>
<p class="text-xs text-gray-500">Llama 2, Llama 3</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200 flex justify-end space-x-3">
<button id="cancelCreateNode" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
Cancel
</button>
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 flex items-center">
<i class="fas fa-check mr-2"></i> Create Node
</button>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
// Toggle sidebar on mobile
document.getElementById('sidebarToggle').addEventListener('click', function() {
document.querySelector('.sidebar').classList.toggle('active');
});
// Show create node modal
document.getElementById('createNodeBtn').addEventListener('click', function() {
document.getElementById('createNodeModal').classList.remove('hidden');
});
// Hide create node modal
document.getElementById('cancelCreateNode').addEventListener('click', function() {
document.getElementById('createNodeModal').classList.add('hidden');
});
// Data source selection
const dataSourceOptions = document.querySelectorAll('.data-source-option');
dataSourceOptions.forEach(option => {
option.addEventListener('click', function() {
dataSourceOptions.forEach(opt => opt.classList.remove('border-blue-500', 'bg-blue-50'));
this.classList.add('border-blue-500', 'bg-blue-50');
});
});
// LLM selection
const llmOptions = document.querySelectorAll('.llm-option');
llmOptions.forEach(option => {
option.addEventListener('click', function() {
llmOptions.forEach(opt => opt.classList.remove('border-purple-500', 'bg-purple-50'));
this.classList.add('border-purple-500', 'bg-purple-50');
});
});
// Toggle between data source configs
document.querySelectorAll('input[name="sourceType"]').forEach(radio => {
radio.addEventListener('change', function() {
if (this.value === 'Database') {
document.getElementById('databaseConfig').classList.remove('hidden');
document.getElementById('documentConfig').classList.add('hidden');
} else if (this.value === 'Document Files') {
document.getElementById('databaseConfig').classList.add('hidden');
document.getElementById('documentConfig').classList.remove('hidden');
}
});
});
// Show node detail view
function showNodeDetail(nodeId) {
document.getElementById('dashboardView').classList.add('hidden');
document.getElementById('nodeDetailView').classList.remove('hidden');
// Update node details based on the selected node
// In a real app, you would fetch this data from your backend
const nodeDetails = {
'customer-support': {
title: 'Customer Support',
id: 'customer-support',
status: 'Active'
},
'hr-assistant': {
title: 'HR Assistant',
id: 'hr-assistant',
status: 'Draft'
},
'tech-support': {
title: 'Tech Support',
id: 'tech-support',
status: 'Active'
}
};
const node = nodeDetails[nodeId];
document.getElementById('nodeDetailTitle').textContent = node.title;
document.getElementById('nodeDetailId').textContent = node.id;
}
// Show dashboard view
function showDashboard() {
document.getElementById('dashboardView').classList.remove('hidden');
document.getElementById('nodeDetailView').classList.add('hidden');
}
// Show export options modal
function showExportOptions() {
const modal = document.getElementById('exportOptionsModal');
const nodeId = document.getElementById('nodeDetailId').textContent;
// Update node IDs in the export options
document.querySelectorAll('#nodeIdForEmbed, #nodeIdForApi').forEach(el => {
el.textContent = nodeId;
});
modal.classList.remove('hidden');
}
// Copy text to clipboard
function copyToClipboard(element) {
const text = element.textContent || element.innerText;
navigator.clipboard.writeText(text).then(() => {
const originalText = element.nextElementSibling.innerHTML;
element.nextElementSibling.innerHTML = '<i class="fas fa-check mr-1"></i> Copied!';
setTimeout(() => {
element.nextElementSibling.innerHTML = originalText;
}, 2000);
});
}
// Close modal when clicking outside
document.getElementById('createNodeModal').addEventListener('click', function(e) {
if (e.target === this) {
this.classList.add('hidden');
}
});
</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=nam1608/manager-node" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |