Spaces:
Sleeping
Sleeping
File size: 41,549 Bytes
4343907 |
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 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 |
<template>
<div v-if="isVisible" class="modal-overlay" @click="closeModal">
<div class="modal-container" @click.stop>
<!-- Modal Header -->
<div class="modal-header">
<h2 class="modal-title">
🤖 Multi-Agent Communication
</h2>
<p class="modal-subtitle">
Jane Alesi Master Coordinator mit automatischer Spezialist-Delegation
</p>
<button @click="closeModal" class="close-button">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div class="modal-body">
<!-- 🔧 KOMPAKTER: Capabilities Section -->
<div class="capabilities-section">
<h3 class="section-title">Verfügbare Spezialisten</h3>
<div class="specialists-grid">
<div
v-for="specialist in availableSpecialists"
:key="specialist.id"
:class="['specialist-card', { 'active': specialist.id === selectedSpecialist }]"
>
<div class="specialist-icon">{{ getSpecialistIcon(specialist.specialization) }}</div>
<div class="specialist-info">
<div class="specialist-name">{{ specialist.name }}</div>
<div class="specialist-role">{{ specialist.specialization }}</div>
</div>
</div>
</div>
</div>
<!-- 🚀 MASSIV VERGRÖSSERT: Chat Interface -->
<div class="chat-section">
<div class="chat-messages" ref="messagesContainer">
<div
v-for="message in chatMessages"
:key="message.id"
:class="['message', message.type]"
>
<div class="message-header">
<div class="message-agent">
<span class="agent-icon">{{ getAgentIcon(message.agent) }}</span>
<span class="agent-name">{{ message.agentName }}</span>
<span v-if="message.role" class="agent-role">({{ message.role }})</span>
</div>
<div class="message-time">{{ formatTime(message.timestamp) }}</div>
</div>
<div class="message-content">
{{ message.content }}
</div>
<div v-if="message.processingTime || message.provider" class="message-meta">
<span v-if="message.provider" class="provider-badge" :class="message.provider">
<span v-if="message.provider === 'colossus'">🔒 Colossus (Intern)</span>
<span v-else-if="message.provider === 'openrouter'">🌐 OpenRouter (Extern)</span>
<span v-else>{{ message.provider }}</span>
</span>
<span v-if="message.processingTime" class="processing-time">⏱️ {{ message.processingTime }}s</span>
<span v-if="message.cost" class="cost-info">💰 {{ message.cost }}</span>
</div>
</div>
<!-- 🚀 ENHANCED: Coordination Chain Visualization -->
<div v-if="currentCoordinationChain.length > 0" class="coordination-chain">
<h4 class="chain-title">🔄 Agent Delegation Chain:</h4>
<div class="chain-flow">
<div
v-for="(agent, index) in currentCoordinationChain"
:key="index"
class="chain-agent"
>
<span class="chain-icon">{{ getAgentIcon(agent) }}</span>
<span class="chain-name">{{ getAgentName(agent) }}</span>
<svg v-if="index < currentCoordinationChain.length - 1" class="chain-arrow" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10.293 15.707a1 1 0 010-1.414L14.586 10l-4.293-4.293a1 1 0 111.414-1.414l5 5a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0z" clip-rule="evenodd"></path>
</svg>
</div>
</div>
</div>
<!-- Loading state with better delegation visibility -->
<div v-if="isProcessing" class="message processing">
<div class="message-header">
<div class="message-agent">
<span class="agent-icon loading">🤖</span>
<span class="agent-name">{{ currentProcessor }}</span>
<span class="agent-role">({{ processingStatus }})</span>
</div>
</div>
<div class="message-content">
<div class="typing-indicator">
<span></span>
<span></span>
<span></span>
</div>
<div v-if="processingStatus.includes('delegiert')" class="delegation-status">
🔄 Agent-zu-Agent Kommunikation läuft...
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 🔒 AUTONOME Privacy-Info Toast (nur Information) -->
<transition name="toast-fade">
<div v-if="showPrivacyInfo" class="privacy-toast">
<div class="toast-icon">🔒</div>
<div class="toast-content">
<div class="toast-title">Sensible Daten erkannt</div>
<div class="toast-message">Ihre Anfrage wird automatisch über den sicheren Colossus-Server (intern) verarbeitet</div>
</div>
<div class="toast-indicator">
<div class="progress-bar"></div>
</div>
</div>
</transition>
<!-- 🚀 INPUT BEREICH GARANTIERT SICHTBAR -->
<div class="chat-input-section">
<div class="input-group">
<textarea
v-model="currentMessage"
@keydown.enter.exact.prevent="sendMessage"
@keydown.enter.shift.exact="() => {}"
placeholder="Stelle eine Frage oder gib eine Aufgabe ein..."
class="message-input"
rows="3"
:disabled="isProcessing"
></textarea>
<button
@click="sendMessage"
:disabled="!canSendMessage"
class="send-button"
>
<svg v-if="!isProcessing" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"></path>
</svg>
<div v-else class="spinner"></div>
</button>
</div>
<div class="input-options">
<div class="options-row">
<div class="task-priority">
<label for="priority">Priorität:</label>
<select v-model="taskPriority" id="priority" class="priority-select">
<option value="normal">Normal</option>
<option value="high">Hoch</option>
<option value="urgent">Dringend</option>
<option value="low">Niedrig</option>
</select>
</div>
<div class="preferred-agent">
<label for="preferredAgent">Bevorzugter Agent:</label>
<select v-model="preferredAgent" id="preferredAgent" class="agent-select">
<option value="">Automatische Auswahl</option>
<option value="john_alesi">John Alesi (Development)</option>
<option value="lara_alesi">Lara Alesi (Medical)</option>
<option value="justus_alesi">Justus Alesi (Legal)</option>
<option value="theo_alesi">Theo Alesi (Finance)</option>
<option value="leon_alesi">Leon Alesi (System)</option>
<option value="luna_alesi">Luna Alesi (Coaching)</option>
</select>
</div>
</div>
<div class="provider-row">
<div class="provider-selection">
<label for="provider">🔒 Datenschutz-Modus:</label>
<select
v-model="selectedProvider"
id="provider"
class="provider-select"
:class="{'privacy-mode': selectedProvider === 'colossus'}"
>
<option value="auto">🔄 Automatisch</option>
<option value="colossus">🔒 Colossus (Intern)</option>
<option value="openrouter">🌐 OpenRouter (Extern)</option>
</select>
<div v-if="selectedProvider === 'colossus'" class="privacy-badge">
✅ Daten geschützt
</div>
<div v-else-if="selectedProvider === 'auto'" class="privacy-badge auto">
🔄 Auto-Erkennung
</div>
</div>
</div>
</div>
</div>
<!-- 🔧 KOMPAKTER: Modal Footer -->
<div class="modal-footer">
<div class="footer-stats">
<span class="stat-item">
<span class="stat-icon">💬</span>
<span class="stat-value">{{ chatMessages.length }}</span>
<span class="stat-label">Messages</span>
</span>
<span class="stat-item">
<span class="stat-icon">🤖</span>
<span class="stat-value">{{ uniqueAgentsCount }}</span>
<span class="stat-label">Agents</span>
</span>
<span class="stat-item">
<span class="stat-icon">⏱️</span>
<span class="stat-value">{{ averageResponseTime }}s</span>
<span class="stat-label">Avg Response</span>
</span>
</div>
<div class="footer-actions">
<button @click="showSystemStatus" class="action-button system-status">
📊 System Status
</button>
<button @click="showPerformanceReport" class="action-button performance">
⚡ Performance Report
</button>
<button @click="showListAgents" class="action-button list-agents">
👥 List Agents
</button>
<button @click="showHelp" class="action-button help">
❓ Help
</button>
<button @click="clearChat" class="clear-button">
🗑️ Clear
</button>
<button @click="closeModal" class="close-modal-button">
Schließen
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import { ref, computed, nextTick, onMounted } from 'vue'
import { saapApi } from '../../services/saapApi'
export default {
name: 'MultiAgentChatModal',
props: {
isVisible: {
type: Boolean,
default: false
}
},
emits: ['close'],
setup(props, { emit }) {
// Reactive state
const chatMessages = ref([])
const currentMessage = ref('')
const isProcessing = ref(false)
const currentProcessor = ref('Jane Alesi')
const processingStatus = ref('Ready')
const selectedSpecialist = ref(null)
const currentCoordinationChain = ref([])
const taskPriority = ref('normal')
const preferredAgent = ref('')
const messagesContainer = ref(null)
const selectedProvider = ref('auto')
const showPrivacyInfo = ref(false)
// Available specialists data
const availableSpecialists = ref([
{
id: 'john_alesi',
name: 'John Alesi',
specialization: 'Development',
description: 'Software-Entwicklung und AGI-Architekturen'
},
{
id: 'lara_alesi',
name: 'Lara Alesi',
specialization: 'Medical',
description: 'Medizinische Expertise und Gesundheitswesen'
},
{
id: 'justus_alesi',
name: 'Justus Alesi',
specialization: 'Legal',
description: 'Rechtsberatung für DE/CH/EU'
},
{
id: 'theo_alesi',
name: 'Theo Alesi',
specialization: 'Finance',
description: 'Finanz- und Investitionsanalyse'
},
{
id: 'leon_alesi',
name: 'Leon Alesi',
specialization: 'System',
description: 'IT-Systemintegration und Infrastructure'
},
{
id: 'luna_alesi',
name: 'Luna Alesi',
specialization: 'Coaching',
description: 'Coaching und Organisationsentwicklung'
}
])
// Computed properties
const canSendMessage = computed(() => {
return currentMessage.value.trim().length > 0 && !isProcessing.value
})
const uniqueAgentsCount = computed(() => {
const agents = new Set(chatMessages.value.map(msg => msg.agent))
return agents.size
})
const averageResponseTime = computed(() => {
const responseTimes = chatMessages.value
.filter(msg => msg.processingTime)
.map(msg => msg.processingTime)
if (responseTimes.length === 0) return 0
return (responseTimes.reduce((sum, time) => sum + time, 0) / responseTimes.length).toFixed(1)
})
// Helper functions
const getSpecialistIcon = (specialization) => {
const icons = {
'Development': '💻',
'Medical': '⚕️',
'Legal': '⚖️',
'Finance': '💰',
'System': '🔧',
'Coaching': '🎯'
}
return icons[specialization] || '🤖'
}
const getAgentIcon = (agentId) => {
const icons = {
'jane_alesi': '👩💼',
'john_alesi': '💻',
'lara_alesi': '⚕️',
'justus_alesi': '⚖️',
'theo_alesi': '💰',
'leon_alesi': '🔧',
'luna_alesi': '🎯',
'user': '👤'
}
return icons[agentId] || '🤖'
}
const getAgentName = (agentId) => {
const names = {
'jane_alesi': 'Jane Alesi',
'john_alesi': 'John Alesi',
'lara_alesi': 'Lara Alesi',
'justus_alesi': 'Justus Alesi',
'theo_alesi': 'Theo Alesi',
'leon_alesi': 'Leon Alesi',
'luna_alesi': 'Luna Alesi'
}
return names[agentId] || agentId
}
const formatTime = (timestamp) => {
return new Date(timestamp).toLocaleTimeString('de-DE', {
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
})
}
const scrollToBottom = () => {
nextTick(() => {
if (messagesContainer.value) {
messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight
}
})
}
// Message handling
const addMessage = (content, agent, agentName, type = 'agent', meta = {}) => {
const message = {
id: Date.now() + Math.random(),
content,
agent,
agentName,
type,
timestamp: new Date(),
role: meta.role,
processingTime: meta.processingTime,
cost: meta.cost,
provider: meta.provider
}
chatMessages.value.push(message)
scrollToBottom()
return message
}
const sendMessage = async () => {
if (!canSendMessage.value) return
const message = currentMessage.value.trim()
currentMessage.value = ''
// 🔒 AUTONOME Privacy-Detection - keine Benutzer-Interaktion!
if (selectedProvider.value !== 'colossus') {
const privacyCheck = await checkPrivacy(message)
if (privacyCheck.requiresLocal) {
// Zeige Info-Nachricht
showPrivacyInfo.value = true
// Automatisch nach 3 Sekunden ausblenden
setTimeout(() => {
showPrivacyInfo.value = false
}, 3000)
// Automatisch Colossus verwenden
await sendMessageToBackend(message, 'colossus')
return
}
}
await sendMessageToBackend(message)
}
const sendMessageToBackend = async (message, forceProvider = null) => {
// Add user message
addMessage(message, 'user', 'Du', 'user')
// Start processing
isProcessing.value = true
currentProcessor.value = 'Jane Alesi'
processingStatus.value = 'Analysiert Intent...'
try {
// Determine provider
let provider = forceProvider || selectedProvider.value
if (provider === 'auto') {
provider = null // Let backend decide
}
// Call multi-agent API with provider selection
const response = await saapApi.multiAgentChat(message, {
user_context: {
timestamp: new Date().toISOString().split('.')[0] + 'Z', // 🔧 FIX: Remove milliseconds for Python compatibility
priority: taskPriority.value
},
preferred_agent: preferredAgent.value || null,
task_priority: taskPriority.value,
provider: provider,
privacy_mode: forceProvider || selectedProvider.value
})
// Update coordination chain based on backend response
const coordinationChain = []
coordinationChain.push('jane_alesi')
if (response.specialist_agent && response.specialist_agent !== 'jane_alesi') {
coordinationChain.push(response.specialist_agent)
}
currentCoordinationChain.value = coordinationChain
// Show delegation status if applicable
if (response.delegation_used && response.specialist_agent && response.specialist_agent !== 'jane_alesi') {
processingStatus.value = `Delegiert an ${getAgentName(response.specialist_agent)}...`
}
// Extract response content and provider info
const responseContent = response.response?.content || response.content || 'Keine Antwort erhalten'
const responseTime = response.response?.response_time || response.response_time || 0
const costUsd = response.response?.cost_usd || 0
const usedProvider = response.response?.provider || response.privacy_protection?.selected_provider || forceProvider || selectedProvider.value || 'unknown'
// If delegation was used, show specialist info
if (response.delegation_used && response.specialist_agent) {
const specialistName = getAgentName(response.specialist_agent)
const specialist = availableSpecialists.value.find(s => s.id === response.specialist_agent)
selectedSpecialist.value = response.specialist_agent
// Add delegation indicator
addMessage(
`🔄 Jane Alesi delegiert an ${specialistName} für spezialisierte Bearbeitung...`,
'system',
'System',
'delegation',
{ role: 'Delegation Info' }
)
// Add specialist response with provider info
setTimeout(() => {
addMessage(
responseContent,
response.specialist_agent,
specialistName,
'specialist',
{
role: specialist?.specialization || 'Specialist',
processingTime: responseTime,
provider: usedProvider
}
)
selectedSpecialist.value = null
}, 500)
} else {
// Direct response from Jane (no delegation) with provider info
addMessage(
responseContent,
'jane_alesi',
'Jane Alesi',
'coordinator',
{
role: 'Master Coordinator',
processingTime: responseTime,
cost: costUsd > 0 ? `$${costUsd.toFixed(6)}` : null,
provider: usedProvider
}
)
}
} catch (error) {
console.error('Multi-Agent Chat Error:', error)
addMessage(
'Entschuldigung, es ist ein Fehler bei der Multi-Agent-Kommunikation aufgetreten. Bitte versuche es erneut.',
'jane_alesi',
'Jane Alesi',
'error',
{ role: 'Error Handler' }
)
} finally {
isProcessing.value = false
currentProcessor.value = 'Jane Alesi'
processingStatus.value = 'Ready'
}
}
const checkPrivacy = async (message) => {
// Simple client-side privacy detection
const sensitiveKeywords = {
medical: ['patient', 'diagnose', 'krankheit', 'symptom', 'arzt', 'medikament'],
financial: ['konto', 'iban', 'kreditkarte', 'gehalt', 'steuer'],
personal: ['geburtsdatum', 'adresse', 'telefon', 'ausweis', 'pass']
}
const messageLower = message.toLowerCase()
const detectedCategories = []
for (const [category, keywords] of Object.entries(sensitiveKeywords)) {
if (keywords.some(keyword => messageLower.includes(keyword))) {
detectedCategories.push(category)
}
}
// Check patterns
const patterns = {
email: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/,
phone: /\b(?:\+49|0)\s?\d{3,4}\s?\d{6,8}\b/,
iban: /\b[A-Z]{2}\d{2}[A-Z0-9]{13,29}\b/,
creditCard: /\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/
}
for (const [type, pattern] of Object.entries(patterns)) {
if (pattern.test(message)) {
detectedCategories.push(type)
}
}
return {
requiresLocal: detectedCategories.length > 0,
categories: detectedCategories,
level: detectedCategories.length > 0 ? 'private' : 'public'
}
}
const clearChat = () => {
chatMessages.value = []
currentCoordinationChain.value = []
selectedSpecialist.value = null
// Add welcome message
addMessage(
'Hallo! Ich bin Jane Alesi, deine Master Coordinatorin. Ich kann Aufgaben an spezialisierte Agenten delegieren oder sie selbst bearbeiten. Wie kann ich dir helfen?',
'jane_alesi',
'Jane Alesi',
'coordinator',
{ role: 'Master Coordinator' }
)
}
const closeModal = () => {
emit('close')
}
// 📊 System Status Function
const showSystemStatus = async () => {
try {
const response = await saapApi.getHealth()
const status = response.status === 'healthy' ? '✅ Online' : '⚠️ Degraded'
const agentsActive = availableSpecialists.value.length
const statusMessage = `📊 SYSTEM STATUS REPORT
🟢 Backend: ${status}
🤖 Agents verfügbar: ${agentsActive}/6
🔒 Colossus: ${response.colossus_available ? '✅ Verfügbar' : '❌ Nicht verfügbar'}
🌐 OpenRouter: ${response.openrouter_available ? '✅ Verfügbar' : '❌ Nicht verfügbar'}
💾 Datenbank: ${response.database ? '✅ Verbunden' : '❌ Getrennt'}
⏱️ Uptime: ${response.uptime || 'N/A'}
📅 Zeitstempel: ${new Date().toLocaleString('de-DE')}`
addMessage(statusMessage, 'system', 'System', 'coordinator', { role: 'System Status' })
} catch (error) {
addMessage(
'❌ Fehler beim Abrufen des System-Status. Backend möglicherweise offline.',
'system',
'System',
'error',
{ role: 'Error' }
)
}
}
// ⚡ Performance Report Function
const showPerformanceReport = () => {
const totalMessages = chatMessages.value.length
const userMessages = chatMessages.value.filter(m => m.type === 'user').length
const agentMessages = chatMessages.value.filter(m => m.type !== 'user').length
const delegations = chatMessages.value.filter(m => m.type === 'delegation').length
const responseTimes = chatMessages.value
.filter(m => m.processingTime)
.map(m => m.processingTime)
const avgResponseTime = responseTimes.length > 0
? (responseTimes.reduce((sum, t) => sum + t, 0) / responseTimes.length).toFixed(2)
: '0'
const minResponseTime = responseTimes.length > 0 ? Math.min(...responseTimes).toFixed(2) : '0'
const maxResponseTime = responseTimes.length > 0 ? Math.max(...responseTimes).toFixed(2) : '0'
const colossusMessages = chatMessages.value.filter(m => m.provider === 'colossus').length
const openrouterMessages = chatMessages.value.filter(m => m.provider === 'openrouter').length
const performanceMessage = `⚡ PERFORMANCE REPORT
📊 Nachrichten-Statistik:
Gesamt: ${totalMessages}
Nutzer: ${userMessages}
Agents: ${agentMessages}
Delegationen: ${delegations}
⏱️ Response Times:
Durchschnitt: ${avgResponseTime}s
Minimum: ${minResponseTime}s
Maximum: ${maxResponseTime}s
🔒 Provider-Verteilung:
Colossus (Intern): ${colossusMessages}
OpenRouter (Extern): ${openrouterMessages}
🤖 Aktive Agents: ${uniqueAgentsCount.value}
📅 Session-Start: ${chatMessages.value[0]?.timestamp ? new Date(chatMessages.value[0].timestamp).toLocaleString('de-DE') : 'N/A'}`
addMessage(performanceMessage, 'system', 'System', 'coordinator', { role: 'Performance Report' })
}
// 👥 List Agents Function
const showListAgents = () => {
const agentsList = availableSpecialists.value
.map(agent => {
const messageCount = chatMessages.value.filter(m => m.agent === agent.id).length
const lastUsed = chatMessages.value
.filter(m => m.agent === agent.id)
.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp))[0]
return `${getSpecialistIcon(agent.specialization)} ${agent.name}
Expertise: ${agent.specialization}
Beschreibung: ${agent.description}
Nachrichten: ${messageCount}
Zuletzt aktiv: ${lastUsed ? formatTime(lastUsed.timestamp) : 'Noch nicht verwendet'}`
})
.join('\n\n')
const listMessage = `👥 VERFÜGBARE SPEZIALISTEN (${availableSpecialists.value.length})
${agentsList}
💡 Hinweis: Jane Alesi delegiert automatisch an den passenden Spezialisten basierend auf deiner Anfrage.`
addMessage(listMessage, 'system', 'System', 'coordinator', { role: 'Agent List' })
}
// ❓ Help Function
const showHelp = () => {
const helpMessage = `❓ MULTI-AGENT CHAT - HILFE
🤖 Was ist Multi-Agent Communication?
Jane Alesi ist deine Master Coordinatorin. Sie analysiert deine Anfragen und delegiert automatisch an spezialisierte Agenten.
👥 Verfügbare Spezialisten:
💻 John Alesi - Software-Entwicklung & AGI
⚕️ Lara Alesi - Medizinische Expertise
⚖️ Justus Alesi - Rechtsberatung (DE/CH/EU)
💰 Theo Alesi - Finanz- & Investitionsanalyse
🔧 Leon Alesi - IT-Systemintegration
🎯 Luna Alesi - Coaching & Organisation
🔒 Datenschutz:
🔄 Automatisch: Erkennt sensible Daten automatisch
🔒 Colossus: Interner Server für sensible Daten
🌐 OpenRouter: Externer Provider für normale Anfragen
⚙️ Optionen:
Priorität: Normal, Hoch, Dringend, Niedrig
Agent-Auswahl: Bevorzugter Agent (optional)
Datenschutz-Modus: Auto, Colossus, OpenRouter
💡 Tipps:
✓ Stelle klare, spezifische Fragen
✓ Jane delegiert automatisch zum besten Spezialisten
✓ Sensible Daten werden automatisch geschützt
✓ Nutze die Quick-Actions für System-Infos
📊 Quick Actions:
📊 System Status - Zeigt Backend-Status
⚡ Performance Report - Zeigt Session-Statistiken
👥 List Agents - Zeigt alle verfügbaren Spezialisten
❓ Help - Zeigt diese Hilfe
🚀 Beispiele:
"Hilf mir beim Debuggen meines React-Codes" → John
"Erkläre mir diesen medizinischen Befund" → Lara
"Ist dieser Vertrag rechtlich korrekt?" → Justus
"Analysiere diese Investitionsmöglichkeit" → Theo`
addMessage(helpMessage, 'system', 'System', 'coordinator', { role: 'Help & Documentation' })
}
// Lifecycle
onMounted(() => {
if (chatMessages.value.length === 0) {
clearChat()
}
})
return {
// State
chatMessages,
currentMessage,
isProcessing,
currentProcessor,
processingStatus,
selectedSpecialist,
currentCoordinationChain,
taskPriority,
preferredAgent,
messagesContainer,
availableSpecialists,
selectedProvider,
showPrivacyInfo,
// Computed
canSendMessage,
uniqueAgentsCount,
averageResponseTime,
// Methods
getSpecialistIcon,
getAgentIcon,
getAgentName,
formatTime,
sendMessage,
clearChat,
closeModal,
showSystemStatus,
showPerformanceReport,
showListAgents,
showHelp
}
}
}
</script>
<style scoped>
/* Modal Overlay */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
backdrop-filter: blur(4px);
}
/* 🚀 DEUTLICH VERGRÖSSERT: Modal Container */
.modal-container {
background: white;
border-radius: 16px;
width: 95vw;
max-width: 1200px;
height: 95vh;
max-height: 98vh;
display: flex;
flex-direction: column;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
overflow: hidden;
}
/* Modal Header */
.modal-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
position: relative;
flex-shrink: 0;
}
.modal-title {
margin: 0;
font-size: 24px;
font-weight: 700;
}
.modal-subtitle {
margin: 8px 0 0 0;
font-size: 14px;
opacity: 0.9;
}
.close-button {
position: absolute;
top: 20px;
right: 20px;
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 8px;
padding: 8px;
color: white;
cursor: pointer;
transition: background-color 0.2s;
}
.close-button:hover {
background: rgba(255, 255, 255, 0.3);
}
.close-button svg {
width: 24px;
height: 24px;
}
/* Modal Body */
.modal-body {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
}
/* 🔧 KOMPAKTER: Capabilities Section */
.capabilities-section {
padding: 4px 12px;
border-bottom: 1px solid #e5e7eb;
background: #f9fafb;
flex-shrink: 0;
max-height: 80px;
overflow: hidden;
}
.section-title {
margin: 0 0 4px 0;
font-size: 12px;
font-weight: 600;
color: #374151;
}
.specialists-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
gap: 3px;
}
.specialist-card {
display: flex;
align-items: center;
padding: 4px 6px;
border: 1px solid #e5e7eb;
border-radius: 6px;
background: white;
transition: all 0.2s;
cursor: pointer;
}
.specialist-card:hover {
border-color: #9ca3af;
transform: translateY(-1px);
}
.specialist-card.active {
border-color: #3b82f6;
background: #eff6ff;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.specialist-icon {
font-size: 14px;
margin-right: 4px;
}
.specialist-info {
flex: 1;
}
.specialist-name {
font-size: 10px;
font-weight: 600;
color: #374151;
}
.specialist-role {
font-size: 9px;
color: #6b7280;
}
/* Chat Section */
.chat-section {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
}
/* 🚀 MASSIV VERGRÖSSERT: Chat Messages Container */
.chat-messages {
flex: 1;
min-height: 0;
height: 100%;
overflow-y: auto !important;
overflow-x: hidden;
padding: 16px 20px;
background: #fafafa;
scroll-behavior: smooth;
}
/* Message Styles */
.message {
margin-bottom: 16px;
padding: 12px 16px;
border-radius: 12px;
background: white;
border: 1px solid #e5e7eb;
}
.message.user {
background: #eff6ff;
border-color: #3b82f6;
}
.message.coordinator {
background: #f3e8ff;
border-color: #a855f7;
}
.message.specialist {
background: #fef3c7;
border-color: #f59e0b;
}
.message.delegation {
background: #dbeafe;
border-color: #60a5fa;
}
.message.error {
background: #fee2e2;
border-color: #ef4444;
}
.message.processing {
background: #f0f9ff;
border-color: #38bdf8;
}
.message-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.message-agent {
display: flex;
align-items: center;
gap: 8px;
}
.agent-icon {
font-size: 18px;
}
.agent-icon.loading {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.agent-name {
font-weight: 600;
color: #1f2937;
font-size: 14px;
}
.agent-role {
font-size: 12px;
color: #6b7280;
font-style: italic;
}
.message-time {
font-size: 11px;
color: #9ca3af;
}
.message-content {
color: #374151;
line-height: 1.6;
font-size: 14px;
white-space: pre-wrap;
word-wrap: break-word;
}
.message-meta {
display: flex;
gap: 12px;
margin-top: 8px;
font-size: 11px;
flex-wrap: wrap;
}
.provider-badge {
padding: 2px 8px;
border-radius: 4px;
font-weight: 600;
font-size: 10px;
}
.provider-badge.colossus {
background: #dcfce7;
color: #16a34a;
}
.provider-badge.openrouter {
background: #dbeafe;
color: #2563eb;
}
.processing-time {
color: #6b7280;
}
.cost-info {
color: #f59e0b;
font-weight: 600;
}
/* Typing Indicator */
.typing-indicator {
display: flex;
gap: 4px;
padding: 8px 0;
}
.typing-indicator span {
width: 8px;
height: 8px;
border-radius: 50%;
background: #3b82f6;
animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes typing {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-10px);
}
}
.delegation-status {
margin-top: 8px;
color: #3b82f6;
font-weight: 600;
font-size: 12px;
}
/* Coordination Chain */
.coordination-chain {
margin: 16px 0;
padding: 12px;
background: #f0f9ff;
border: 1px solid #38bdf8;
border-radius: 8px;
}
.chain-title {
margin: 0 0 8px 0;
font-size: 13px;
font-weight: 600;
color: #0c4a6e;
}
.chain-flow {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.chain-agent {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background: white;
border: 1px solid #38bdf8;
border-radius: 6px;
font-size: 12px;
}
.chain-icon {
font-size: 16px;
}
.chain-name {
font-weight: 600;
color: #0c4a6e;
}
.chain-arrow {
width: 16px;
height: 16px;
color: #38bdf8;
}
/* 🔒 Privacy Toast - Modern & User-Friendly */
.privacy-toast {
position: fixed;
bottom: 100px;
left: 50%;
transform: translateX(-50%);
z-index: 1100;
min-width: 400px;
max-width: 500px;
}
.privacy-toast {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
border-radius: 12px;
padding: 16px 20px;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
display: flex;
align-items: center;
gap: 16px;
color: white;
}
.toast-icon {
font-size: 28px;
flex-shrink: 0;
animation: shield-pulse 2s ease-in-out infinite;
}
@keyframes shield-pulse {
0%, 100% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
}
.toast-content {
flex: 1;
}
.toast-title {
font-size: 15px;
font-weight: 700;
margin-bottom: 4px;
letter-spacing: 0.3px;
}
.toast-message {
font-size: 13px;
opacity: 0.95;
line-height: 1.4;
}
.toast-indicator {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: rgba(255, 255, 255, 0.2);
border-radius: 0 0 12px 12px;
overflow: hidden;
}
.progress-bar {
height: 100%;
background: rgba(255, 255, 255, 0.8);
animation: progress 3s linear forwards;
}
@keyframes progress {
from {
width: 100%;
}
to {
width: 0%;
}
}
/* Toast Fade Transition */
.toast-fade-enter-active {
animation: toast-slide-up 0.3s ease-out;
}
.toast-fade-leave-active {
animation: toast-slide-down 0.3s ease-in;
}
@keyframes toast-slide-up {
from {
transform: translateX(-50%) translateY(50px);
opacity: 0;
}
to {
transform: translateX(-50%) translateY(0);
opacity: 1;
}
}
@keyframes toast-slide-down {
from {
transform: translateX(-50%) translateY(0);
opacity: 1;
}
to {
transform: translateX(-50%) translateY(50px);
opacity: 0;
}
}
/* Chat Input Section */
.chat-input-section {
border-top: 2px solid #e5e7eb;
background: white;
padding: 16px 20px;
flex-shrink: 0;
}
.input-group {
display: flex;
gap: 12px;
margin-bottom: 12px;
}
.message-input {
flex: 1;
border: 2px solid #e5e7eb;
border-radius: 8px;
padding: 12px;
font-size: 14px;
font-family: inherit;
resize: vertical;
min-height: 60px;
transition: border-color 0.2s;
}
.message-input:focus {
outline: none;
border-color: #3b82f6;
}
.message-input:disabled {
background: #f3f4f6;
cursor: not-allowed;
}
.send-button {
align-self: flex-end;
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
color: white;
border: none;
border-radius: 8px;
padding: 12px 16px;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
min-width: 48px;
}
.send-button:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.send-button:disabled {
background: #9ca3af;
cursor: not-allowed;
transform: none;
}
.send-button svg {
width: 20px;
height: 20px;
}
.spinner {
width: 20px;
height: 20px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* Input Options */
.input-options {
display: flex;
flex-direction: column;
gap: 8px;
}
.options-row {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.task-priority,
.preferred-agent {
display: flex;
align-items: center;
gap: 8px;
}
.task-priority label,
.preferred-agent label {
font-size: 12px;
color: #6b7280;
font-weight: 500;
}
.priority-select,
.agent-select {
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 12px;
background: white;
cursor: pointer;
transition: border-color 0.2s;
}
.priority-select:focus,
.agent-select:focus {
outline: none;
border-color: #3b82f6;
}
.provider-row {
display: flex;
align-items: center;
}
.provider-selection {
display: flex;
align-items: center;
gap: 8px;
}
.provider-selection label {
font-size: 12px;
color: #6b7280;
font-weight: 500;
}
.provider-select {
padding: 6px 10px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 12px;
background: white;
cursor: pointer;
transition: all 0.2s;
}
.provider-select:focus {
outline: none;
border-color: #3b82f6;
}
.provider-select.privacy-mode {
border-color: #16a34a;
background: #f0fdf4;
}
.privacy-badge {
padding: 4px 8px;
background: #dcfce7;
color: #16a34a;
border-radius: 4px;
font-size: 10px;
font-weight: 600;
}
.privacy-badge.auto {
background: #dbeafe;
color: #2563eb;
}
/* Modal Footer */
.modal-footer {
border-top: 2px solid #e5e7eb;
padding: 12px 20px;
background: #f9fafb;
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
}
.footer-stats {
display: flex;
gap: 20px;
}
.stat-item {
display: flex;
align-items: center;
gap: 6px;
font-size: 12px;
}
.stat-icon {
font-size: 16px;
}
.stat-value {
font-weight: 700;
color: #1f2937;
}
.stat-label {
color: #6b7280;
}
.footer-actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
/* Action Buttons */
.action-button {
padding: 6px 12px;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
border: 1px solid;
white-space: nowrap;
}
.action-button:hover {
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.action-button.system-status {
background: #dbeafe;
color: #1e40af;
border-color: #93c5fd;
}
.action-button.system-status:hover {
background: #bfdbfe;
}
.action-button.performance {
background: #fef3c7;
color: #92400e;
border-color: #fcd34d;
}
.action-button.performance:hover {
background: #fde68a;
}
.action-button.list-agents {
background: #e9d5ff;
color: #6b21a8;
border-color: #d8b4fe;
}
.action-button.list-agents:hover {
background: #ddd6fe;
}
.action-button.help {
background: #d1fae5;
color: #065f46;
border-color: #6ee7b7;
}
.action-button.help:hover {
background: #a7f3d0;
}
.clear-button,
.close-modal-button {
padding: 6px 12px;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.clear-button {
background: #fee2e2;
color: #dc2626;
border: 1px solid #fca5a5;
}
.clear-button:hover {
background: #fecaca;
transform: translateY(-1px);
}
.close-modal-button {
background: #e5e7eb;
color: #374151;
border: 1px solid #d1d5db;
}
.close-modal-button:hover {
background: #d1d5db;
transform: translateY(-1px);
}
/* Utility Classes */
.w-5 {
width: 1.25rem;
}
.h-5 {
height: 1.25rem;
}
.w-6 {
width: 1.5rem;
}
.h-6 {
height: 1.5rem;
}
/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
width: 8px;
}
.chat-messages::-webkit-scrollbar-track {
background: #f3f4f6;
border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
background: #d1d5db;
border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
background: #9ca3af;
}
</style>
|