Upload templates/index.html with huggingface_hub
Browse files- templates/index.html +101 -566
templates/index.html
CHANGED
|
@@ -3,8 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>AEGIS BIO LAB 10 CONDUCTOR
|
| 7 |
-
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
| 8 |
<style>
|
| 9 |
* {
|
| 10 |
margin: 0;
|
|
@@ -13,399 +12,136 @@
|
|
| 13 |
}
|
| 14 |
|
| 15 |
body {
|
| 16 |
-
font-family:
|
| 17 |
-
background:
|
| 18 |
color: #ffffff;
|
| 19 |
min-height: 100vh;
|
| 20 |
-
overflow-x: hidden;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
.container {
|
| 24 |
-
max-width: 1400px;
|
| 25 |
-
margin: 0 auto;
|
| 26 |
-
padding: 20px;
|
| 27 |
-
position: relative;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
.header {
|
| 31 |
-
text-align: center;
|
| 32 |
-
margin-bottom: 30px;
|
| 33 |
-
position: relative;
|
| 34 |
-
z-index: 10;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
.header h1 {
|
| 38 |
-
font-family: 'Orbitron', monospace;
|
| 39 |
-
font-size: 3em;
|
| 40 |
-
font-weight: 900;
|
| 41 |
-
margin-bottom: 15px;
|
| 42 |
-
background: linear-gradient(45deg, #00ff88, #00ccff, #ff6b6b, #ffd93d);
|
| 43 |
-
background-size: 400% 400%;
|
| 44 |
-
-webkit-background-clip: text;
|
| 45 |
-
-webkit-text-fill-color: transparent;
|
| 46 |
-
background-clip: text;
|
| 47 |
-
animation: gradientShift 4s ease-in-out infinite;
|
| 48 |
-
text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
@keyframes gradientShift {
|
| 52 |
-
0%, 100% { background-position: 0% 50%; }
|
| 53 |
-
50% { background-position: 100% 50%; }
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
.subtitle {
|
| 57 |
-
font-size: 1.3em;
|
| 58 |
-
opacity: 0.9;
|
| 59 |
-
margin: 10px 0;
|
| 60 |
-
font-weight: 300;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.version-badge {
|
| 64 |
-
display: inline-block;
|
| 65 |
-
background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
|
| 66 |
-
padding: 8px 20px;
|
| 67 |
-
border-radius: 25px;
|
| 68 |
-
font-size: 0.9em;
|
| 69 |
-
font-weight: 500;
|
| 70 |
-
margin: 10px;
|
| 71 |
-
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.main-panel {
|
| 75 |
-
background: rgba(255, 255, 255, 0.05);
|
| 76 |
-
border-radius: 20px;
|
| 77 |
-
padding: 30px;
|
| 78 |
-
backdrop-filter: blur(20px);
|
| 79 |
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 80 |
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
| 81 |
-
position: relative;
|
| 82 |
-
overflow: hidden;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
.main-panel::before {
|
| 86 |
-
content: '';
|
| 87 |
-
position: absolute;
|
| 88 |
-
top: 0;
|
| 89 |
-
left: 0;
|
| 90 |
-
right: 0;
|
| 91 |
-
height: 2px;
|
| 92 |
-
background: linear-gradient(90deg, #00ff88, #00ccff, #ff6b6b, #ffd93d);
|
| 93 |
-
background-size: 400% 100%;
|
| 94 |
-
animation: borderGlow 3s linear infinite;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
@keyframes borderGlow {
|
| 98 |
-
0% { background-position: 0% 50%; }
|
| 99 |
-
100% { background-position: 400% 50%; }
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
.provider-status {
|
| 103 |
-
display: flex;
|
| 104 |
-
justify-content: space-between;
|
| 105 |
-
align-items: center;
|
| 106 |
-
background: rgba(0, 0, 0, 0.3);
|
| 107 |
-
padding: 20px;
|
| 108 |
-
border-radius: 15px;
|
| 109 |
-
margin-bottom: 25px;
|
| 110 |
-
border: 1px solid rgba(0, 255, 136, 0.3);
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
.provider-info {
|
| 114 |
display: flex;
|
| 115 |
flex-direction: column;
|
| 116 |
-
gap: 5px;
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
.provider-badge {
|
| 120 |
-
background: linear-gradient(45deg, #00ff88, #00ccff);
|
| 121 |
-
padding: 10px 20px;
|
| 122 |
-
border-radius: 25px;
|
| 123 |
-
font-size: 0.9em;
|
| 124 |
-
font-weight: 600;
|
| 125 |
-
color: #000;
|
| 126 |
-
box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
|
| 127 |
-
animation: pulse 2s infinite;
|
| 128 |
}
|
| 129 |
|
| 130 |
-
|
| 131 |
-
0%, 100% { transform: scale(1); }
|
| 132 |
-
50% { transform: scale(1.05); }
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
.status-bar {
|
| 136 |
-
background: linear-gradient(45deg, rgba(0, 0, 0, 0.4), rgba(0, 255, 136, 0.1));
|
| 137 |
-
padding: 15px;
|
| 138 |
-
border-radius: 10px;
|
| 139 |
-
margin-bottom: 25px;
|
| 140 |
-
font-family: 'Orbitron', monospace;
|
| 141 |
-
font-size: 0.9em;
|
| 142 |
-
border-left: 4px solid #00ff88;
|
| 143 |
-
box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.1);
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
.capabilities-grid {
|
| 147 |
-
display: grid;
|
| 148 |
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 149 |
-
gap: 15px;
|
| 150 |
-
margin: 25px 0;
|
| 151 |
-
}
|
| 152 |
-
|
| 153 |
-
.capability-card {
|
| 154 |
-
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
|
| 155 |
-
padding: 20px;
|
| 156 |
-
border-radius: 15px;
|
| 157 |
text-align: center;
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
overflow: hidden;
|
| 162 |
-
}
|
| 163 |
-
|
| 164 |
-
.capability-card:hover {
|
| 165 |
-
transform: translateY(-5px);
|
| 166 |
-
box-shadow: 0 10px 25px rgba(0, 255, 136, 0.2);
|
| 167 |
-
border-color: #00ff88;
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
.capability-card::before {
|
| 171 |
-
content: '';
|
| 172 |
-
position: absolute;
|
| 173 |
-
top: 0;
|
| 174 |
-
left: -100%;
|
| 175 |
-
width: 100%;
|
| 176 |
-
height: 100%;
|
| 177 |
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
|
| 178 |
-
transition: left 0.5s;
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
.capability-card:hover::before {
|
| 182 |
-
left: 100%;
|
| 183 |
}
|
| 184 |
|
| 185 |
-
.
|
| 186 |
font-size: 2em;
|
|
|
|
| 187 |
margin-bottom: 10px;
|
| 188 |
-
display: block;
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
.chat-container {
|
| 192 |
-
background: rgba(0, 0, 0, 0.2);
|
| 193 |
-
border-radius: 15px;
|
| 194 |
-
padding: 25px;
|
| 195 |
-
margin: 25px 0;
|
| 196 |
-
min-height: 400px;
|
| 197 |
-
max-height: 500px;
|
| 198 |
-
overflow-y: auto;
|
| 199 |
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 200 |
-
position: relative;
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
.chat-container::-webkit-scrollbar {
|
| 204 |
-
width: 8px;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
.chat-container::-webkit-scrollbar-track {
|
| 208 |
-
background: rgba(255, 255, 255, 0.1);
|
| 209 |
-
border-radius: 4px;
|
| 210 |
-
}
|
| 211 |
-
|
| 212 |
-
.chat-container::-webkit-scrollbar-thumb {
|
| 213 |
-
background: linear-gradient(45deg, #00ff88, #00ccff);
|
| 214 |
-
border-radius: 4px;
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
.welcome-message {
|
| 218 |
-
text-align: center;
|
| 219 |
-
opacity: 0.8;
|
| 220 |
-
margin-top: 100px;
|
| 221 |
}
|
| 222 |
|
| 223 |
-
.
|
| 224 |
-
|
| 225 |
-
font-size: 1.
|
| 226 |
-
margin-bottom: 20px;
|
| 227 |
-
color: #00ff88;
|
| 228 |
-
text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
|
| 229 |
}
|
| 230 |
|
| 231 |
-
.
|
| 232 |
-
|
| 233 |
padding: 20px;
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
position: relative;
|
| 237 |
}
|
| 238 |
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
|
|
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
.message.user {
|
| 245 |
-
background:
|
| 246 |
-
margin-left:
|
| 247 |
text-align: right;
|
| 248 |
border-left: 4px solid #00ff88;
|
| 249 |
}
|
| 250 |
|
| 251 |
.message.assistant {
|
| 252 |
-
background:
|
| 253 |
-
margin-right: 15%;
|
| 254 |
border-left: 4px solid #00ccff;
|
| 255 |
}
|
| 256 |
|
| 257 |
.message-header {
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
font-weight: 600;
|
| 262 |
-
opacity: 0.9;
|
| 263 |
-
}
|
| 264 |
-
|
| 265 |
-
.message-header .icon {
|
| 266 |
-
margin-right: 8px;
|
| 267 |
-
font-size: 1.2em;
|
| 268 |
}
|
| 269 |
|
| 270 |
.input-container {
|
|
|
|
|
|
|
|
|
|
| 271 |
display: flex;
|
| 272 |
-
gap:
|
| 273 |
-
margin-top: 25px;
|
| 274 |
-
align-items: stretch;
|
| 275 |
}
|
| 276 |
|
| 277 |
.input-container input {
|
| 278 |
flex: 1;
|
| 279 |
-
padding:
|
| 280 |
-
border:
|
| 281 |
-
border-radius:
|
| 282 |
-
background:
|
| 283 |
color: #ffffff;
|
| 284 |
font-size: 16px;
|
| 285 |
outline: none;
|
| 286 |
-
border: 2px solid transparent;
|
| 287 |
-
transition: all 0.3s ease;
|
| 288 |
-
backdrop-filter: blur(10px);
|
| 289 |
}
|
| 290 |
|
| 291 |
.input-container input:focus {
|
| 292 |
border-color: #00ff88;
|
| 293 |
-
box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
|
| 294 |
-
background: rgba(255, 255, 255, 0.15);
|
| 295 |
}
|
| 296 |
|
| 297 |
.input-container input::placeholder {
|
| 298 |
-
color:
|
| 299 |
}
|
| 300 |
|
| 301 |
.send-button {
|
| 302 |
-
padding:
|
| 303 |
border: none;
|
| 304 |
-
border-radius:
|
| 305 |
-
background:
|
| 306 |
-
color: #
|
| 307 |
cursor: pointer;
|
| 308 |
font-size: 16px;
|
| 309 |
-
font-weight:
|
| 310 |
-
transition:
|
| 311 |
-
box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
|
| 312 |
-
position: relative;
|
| 313 |
-
overflow: hidden;
|
| 314 |
}
|
| 315 |
|
| 316 |
.send-button:hover {
|
| 317 |
-
|
| 318 |
-
box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4);
|
| 319 |
-
}
|
| 320 |
-
|
| 321 |
-
.send-button:active {
|
| 322 |
-
transform: translateY(0);
|
| 323 |
}
|
| 324 |
|
| 325 |
.send-button:disabled {
|
|
|
|
| 326 |
cursor: not-allowed;
|
| 327 |
-
opacity: 0.6;
|
| 328 |
-
}
|
| 329 |
-
|
| 330 |
-
.sample-prompt {
|
| 331 |
-
background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 255, 0.2));
|
| 332 |
-
border: 1px solid rgba(0, 255, 136, 0.4);
|
| 333 |
-
color: #ffffff;
|
| 334 |
-
padding: 12px 16px;
|
| 335 |
-
border-radius: 10px;
|
| 336 |
-
cursor: pointer;
|
| 337 |
-
font-size: 0.9em;
|
| 338 |
-
transition: all 0.3s ease;
|
| 339 |
-
text-align: left;
|
| 340 |
}
|
| 341 |
|
| 342 |
-
.
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
|
| 347 |
}
|
| 348 |
|
| 349 |
.loading {
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
}
|
| 353 |
-
|
| 354 |
-
@keyframes loadingPulse {
|
| 355 |
-
0%, 100% { opacity: 1; }
|
| 356 |
-
50% { opacity: 0.5; }
|
| 357 |
-
}
|
| 358 |
-
|
| 359 |
-
.floating-particles {
|
| 360 |
-
position: fixed;
|
| 361 |
-
top: 0;
|
| 362 |
-
left: 0;
|
| 363 |
-
width: 100%;
|
| 364 |
-
height: 100%;
|
| 365 |
-
pointer-events: none;
|
| 366 |
-
z-index: 1;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
.particle {
|
| 370 |
-
position: absolute;
|
| 371 |
-
width: 4px;
|
| 372 |
-
height: 4px;
|
| 373 |
-
background: #00ff88;
|
| 374 |
-
border-radius: 50%;
|
| 375 |
-
animation: float 6s infinite linear;
|
| 376 |
-
opacity: 0.6;
|
| 377 |
}
|
| 378 |
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
}
|
| 384 |
-
10% {
|
| 385 |
-
opacity: 0.6;
|
| 386 |
-
}
|
| 387 |
-
90% {
|
| 388 |
-
opacity: 0.6;
|
| 389 |
-
}
|
| 390 |
-
100% {
|
| 391 |
-
transform: translateY(-10vh) rotate(360deg);
|
| 392 |
-
opacity: 0;
|
| 393 |
-
}
|
| 394 |
}
|
| 395 |
|
| 396 |
@media (max-width: 768px) {
|
| 397 |
.header h1 {
|
| 398 |
-
font-size:
|
| 399 |
-
}
|
| 400 |
-
|
| 401 |
-
.provider-status {
|
| 402 |
-
flex-direction: column;
|
| 403 |
-
gap: 15px;
|
| 404 |
-
text-align: center;
|
| 405 |
}
|
| 406 |
|
| 407 |
-
.
|
| 408 |
-
|
| 409 |
}
|
| 410 |
|
| 411 |
.input-container {
|
|
@@ -415,288 +151,92 @@
|
|
| 415 |
</style>
|
| 416 |
</head>
|
| 417 |
<body>
|
| 418 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
| 419 |
|
| 420 |
-
<div class="container">
|
| 421 |
-
<div class="
|
| 422 |
-
<
|
| 423 |
-
<p
|
| 424 |
-
<
|
| 425 |
-
</div>
|
| 426 |
-
|
| 427 |
-
<div class="main-panel">
|
| 428 |
-
<div class="provider-status">
|
| 429 |
-
<div class="provider-info">
|
| 430 |
-
<div><strong>🔄 Current Provider:</strong> <span id="current-provider">Loading...</span></div>
|
| 431 |
-
<div><strong>🌐 Model:</strong> DeepSeek-V3.2-Exp</div>
|
| 432 |
-
</div>
|
| 433 |
-
<div class="provider-badge" id="provider-badge">Multi-Provider Active</div>
|
| 434 |
-
</div>
|
| 435 |
-
|
| 436 |
-
<div class="status-bar" id="status">
|
| 437 |
-
🔄 Initializing AEGIS BIO LAB 10 CONDUCTOR with DeepSeek-V3.2-Exp...
|
| 438 |
-
</div>
|
| 439 |
-
|
| 440 |
-
<div class="capabilities-grid">
|
| 441 |
-
<div class="capability-card">
|
| 442 |
-
<span class="capability-icon">📊</span>
|
| 443 |
-
<strong>Economics</strong>
|
| 444 |
-
<p>Market Analysis & Financial Intelligence</p>
|
| 445 |
-
</div>
|
| 446 |
-
<div class="capability-card">
|
| 447 |
-
<span class="capability-icon">🔬</span>
|
| 448 |
-
<strong>Technology</strong>
|
| 449 |
-
<p>AI Impact & Innovation Assessment</p>
|
| 450 |
-
</div>
|
| 451 |
-
<div class="capability-card">
|
| 452 |
-
<span class="capability-icon">🛡️</span>
|
| 453 |
-
<strong>Security</strong>
|
| 454 |
-
<p>Threat Analysis & Risk Evaluation</p>
|
| 455 |
-
</div>
|
| 456 |
-
<div class="capability-card">
|
| 457 |
-
<span class="capability-icon">🏥</span>
|
| 458 |
-
<strong>Health</strong>
|
| 459 |
-
<p>Biotech & Public Health Systems</p>
|
| 460 |
-
</div>
|
| 461 |
-
<div class="capability-card">
|
| 462 |
-
<span class="capability-icon">🌍</span>
|
| 463 |
-
<strong>Environment</strong>
|
| 464 |
-
<p>Climate & Sustainability Analysis</p>
|
| 465 |
-
</div>
|
| 466 |
-
<div class="capability-card">
|
| 467 |
-
<span class="capability-icon">📈</span>
|
| 468 |
-
<strong>Strategy</strong>
|
| 469 |
-
<p>Long-term Planning & Policy</p>
|
| 470 |
-
</div>
|
| 471 |
-
</div>
|
| 472 |
-
|
| 473 |
-
<div class="chat-container" id="chat-messages">
|
| 474 |
-
<div class="welcome-message">
|
| 475 |
-
<h3>🤖 AEGIS CONDUCTOR Ready</h3>
|
| 476 |
-
<p>Advanced multi-domain analysis with intelligent provider failover</p>
|
| 477 |
-
<p style="margin-top: 15px; opacity: 0.7;">
|
| 478 |
-
Ask me anything - the system automatically switches between Novita, Fireworks, and Auto providers when quotas are exhausted.
|
| 479 |
-
</p>
|
| 480 |
-
|
| 481 |
-
<div style="margin-top: 25px;">
|
| 482 |
-
<h4 style="color: #00ccff; margin-bottom: 15px;">💡 Try these sample questions:</h4>
|
| 483 |
-
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-top: 15px;">
|
| 484 |
-
<button class="sample-prompt" onclick="useSamplePrompt('What are the key economic trends for 2025?')">
|
| 485 |
-
📊 Economic Trends 2025
|
| 486 |
-
</button>
|
| 487 |
-
<button class="sample-prompt" onclick="useSamplePrompt('Analyze the impact of AI on cybersecurity')">
|
| 488 |
-
🔬 AI & Cybersecurity
|
| 489 |
-
</button>
|
| 490 |
-
<button class="sample-prompt" onclick="useSamplePrompt('What are the main climate risks for global supply chains?')">
|
| 491 |
-
🌍 Climate & Supply Chains
|
| 492 |
-
</button>
|
| 493 |
-
<button class="sample-prompt" onclick="useSamplePrompt('Assess the geopolitical implications of renewable energy adoption')">
|
| 494 |
-
🛡️ Geopolitics & Energy
|
| 495 |
-
</button>
|
| 496 |
-
</div>
|
| 497 |
-
</div>
|
| 498 |
-
</div>
|
| 499 |
-
</div>
|
| 500 |
-
|
| 501 |
-
<div class="input-container">
|
| 502 |
-
<input type="text" id="message-input" placeholder="Enter your question for AEGIS multi-domain analysis..." onkeypress="handleKeyPress(event)">
|
| 503 |
-
<button class="send-button" onclick="sendMessage()">🚀 Analyze</button>
|
| 504 |
-
</div>
|
| 505 |
-
|
| 506 |
-
<div style="margin-top: 10px; text-align: center;">
|
| 507 |
-
<button onclick="testFunction()" style="background: #666; padding: 8px 16px; border: none; border-radius: 5px; color: white; cursor: pointer; font-size: 12px;">
|
| 508 |
-
🔧 Test Function
|
| 509 |
-
</button>
|
| 510 |
-
<button onclick="console.log('Console test')" style="background: #666; padding: 8px 16px; border: none; border-radius: 5px; color: white; cursor: pointer; font-size: 12px; margin-left: 5px;">
|
| 511 |
-
📝 Console Test
|
| 512 |
-
</button>
|
| 513 |
-
</div>
|
| 514 |
</div>
|
| 515 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
|
| 517 |
<script>
|
| 518 |
let chatHistory = [];
|
| 519 |
|
| 520 |
-
// Initialize particles
|
| 521 |
-
function createParticles() {
|
| 522 |
-
const container = document.getElementById('particles');
|
| 523 |
-
for (let i = 0; i < 50; i++) {
|
| 524 |
-
const particle = document.createElement('div');
|
| 525 |
-
particle.className = 'particle';
|
| 526 |
-
particle.style.left = Math.random() * 100 + '%';
|
| 527 |
-
particle.style.animationDelay = Math.random() * 6 + 's';
|
| 528 |
-
particle.style.animationDuration = (Math.random() * 3 + 3) + 's';
|
| 529 |
-
container.appendChild(particle);
|
| 530 |
-
}
|
| 531 |
-
}
|
| 532 |
-
|
| 533 |
-
window.onload = function() {
|
| 534 |
-
createParticles();
|
| 535 |
-
loadStatus();
|
| 536 |
-
loadProviderStatus();
|
| 537 |
-
document.getElementById('message-input').focus();
|
| 538 |
-
};
|
| 539 |
-
|
| 540 |
-
function loadStatus() {
|
| 541 |
-
fetch('/status')
|
| 542 |
-
.then(response => {
|
| 543 |
-
if (!response.ok) {
|
| 544 |
-
throw new Error(`HTTP ${response.status}`);
|
| 545 |
-
}
|
| 546 |
-
return response.json();
|
| 547 |
-
})
|
| 548 |
-
.then(data => {
|
| 549 |
-
document.getElementById('status').innerHTML =
|
| 550 |
-
`✅ ${data.status} | Regions: ${data.regions} | Providers: ${data.providers.join(', ')}`;
|
| 551 |
-
})
|
| 552 |
-
.catch(error => {
|
| 553 |
-
console.error('Status error:', error);
|
| 554 |
-
document.getElementById('status').innerHTML =
|
| 555 |
-
'❌ Connection error - Please check if the space is running and API keys are configured';
|
| 556 |
-
});
|
| 557 |
-
}
|
| 558 |
-
|
| 559 |
-
function loadProviderStatus() {
|
| 560 |
-
fetch('/provider_status')
|
| 561 |
-
.then(response => {
|
| 562 |
-
if (!response.ok) {
|
| 563 |
-
throw new Error(`HTTP ${response.status}`);
|
| 564 |
-
}
|
| 565 |
-
return response.json();
|
| 566 |
-
})
|
| 567 |
-
.then(data => {
|
| 568 |
-
document.getElementById('current-provider').textContent =
|
| 569 |
-
`${data.current_provider} (${data.current_provider_type})`;
|
| 570 |
-
})
|
| 571 |
-
.catch(error => {
|
| 572 |
-
console.error('Provider status error:', error);
|
| 573 |
-
document.getElementById('current-provider').textContent =
|
| 574 |
-
'Connection error - Check API keys in Settings';
|
| 575 |
-
});
|
| 576 |
-
}
|
| 577 |
-
|
| 578 |
function handleKeyPress(event) {
|
| 579 |
if (event.key === 'Enter') {
|
| 580 |
sendMessage();
|
| 581 |
}
|
| 582 |
}
|
| 583 |
|
| 584 |
-
function useSamplePrompt(prompt) {
|
| 585 |
-
const input = document.getElementById('message-input');
|
| 586 |
-
input.value = prompt;
|
| 587 |
-
input.focus();
|
| 588 |
-
// Optionally auto-send the message
|
| 589 |
-
sendMessage();
|
| 590 |
-
}
|
| 591 |
-
|
| 592 |
-
function testFunction() {
|
| 593 |
-
console.log('🧪 Test function called');
|
| 594 |
-
alert('Test function works! Check console for logs.');
|
| 595 |
-
|
| 596 |
-
// Test basic elements
|
| 597 |
-
const input = document.getElementById('message-input');
|
| 598 |
-
const button = document.querySelector('.send-button');
|
| 599 |
-
|
| 600 |
-
console.log('📝 Input element:', input);
|
| 601 |
-
console.log('🔘 Button element:', button);
|
| 602 |
-
|
| 603 |
-
if (input) {
|
| 604 |
-
console.log('✅ Input found, value:', input.value);
|
| 605 |
-
} else {
|
| 606 |
-
console.log('❌ Input not found');
|
| 607 |
-
}
|
| 608 |
-
|
| 609 |
-
if (button) {
|
| 610 |
-
console.log('✅ Button found, onclick:', button.onclick);
|
| 611 |
-
} else {
|
| 612 |
-
console.log('❌ Button not found');
|
| 613 |
-
}
|
| 614 |
-
}
|
| 615 |
-
|
| 616 |
function sendMessage() {
|
| 617 |
-
console.log('🚀 sendMessage() called');
|
| 618 |
-
|
| 619 |
const input = document.getElementById('message-input');
|
|
|
|
| 620 |
const message = input.value.trim();
|
| 621 |
|
| 622 |
-
console.log('📝 Message:', message);
|
| 623 |
-
|
| 624 |
if (!message) {
|
| 625 |
-
|
| 626 |
-
// Flash the input to indicate it's empty
|
| 627 |
-
input.style.borderColor = '#ff6b6b';
|
| 628 |
setTimeout(() => {
|
| 629 |
-
input.style.borderColor = '
|
| 630 |
-
},
|
| 631 |
return;
|
| 632 |
}
|
| 633 |
|
| 634 |
-
// Disable button
|
| 635 |
-
const button = document.querySelector('.send-button');
|
| 636 |
-
console.log('🔘 Button found:', button);
|
| 637 |
-
|
| 638 |
button.disabled = true;
|
| 639 |
-
button.
|
| 640 |
-
button.innerHTML = '⏳ Analyzing...';
|
| 641 |
-
|
| 642 |
-
console.log('🔄 Button disabled, starting request');
|
| 643 |
|
| 644 |
// Clear welcome message
|
| 645 |
const welcomeMsg = document.querySelector('.welcome-message');
|
| 646 |
if (welcomeMsg) {
|
| 647 |
welcomeMsg.style.display = 'none';
|
| 648 |
-
console.log('👋 Welcome message hidden');
|
| 649 |
}
|
| 650 |
|
| 651 |
// Add user message
|
| 652 |
-
|
| 653 |
input.value = '';
|
| 654 |
|
| 655 |
-
//
|
| 656 |
-
const loadingId =
|
| 657 |
-
console.log('⏳ Loading message added with ID:', loadingId);
|
| 658 |
-
|
| 659 |
-
const payload = {
|
| 660 |
-
message: message,
|
| 661 |
-
history: chatHistory,
|
| 662 |
-
analysis_type: 'general'
|
| 663 |
-
};
|
| 664 |
-
|
| 665 |
-
console.log('📤 Sending payload:', payload);
|
| 666 |
|
| 667 |
-
// Send
|
| 668 |
fetch('/chat', {
|
| 669 |
method: 'POST',
|
| 670 |
headers: {
|
| 671 |
'Content-Type': 'application/json',
|
| 672 |
},
|
| 673 |
-
body: JSON.stringify(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 674 |
})
|
| 675 |
.then(response => {
|
| 676 |
-
console.log('📥 Response received:', response.status, response.statusText);
|
| 677 |
-
|
| 678 |
if (!response.ok) {
|
| 679 |
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
| 680 |
}
|
| 681 |
return response.json();
|
| 682 |
})
|
| 683 |
.then(data => {
|
| 684 |
-
console.log('✅ Response data:', data);
|
| 685 |
-
|
| 686 |
// Remove loading message
|
| 687 |
const loadingElement = document.getElementById(loadingId);
|
| 688 |
if (loadingElement) {
|
| 689 |
loadingElement.remove();
|
| 690 |
-
console.log('🗑️ Loading message removed');
|
| 691 |
}
|
| 692 |
|
| 693 |
// Add response
|
| 694 |
-
|
| 695 |
|
| 696 |
-
// Update
|
| 697 |
-
loadProviderStatus();
|
| 698 |
-
|
| 699 |
-
// Add to history
|
| 700 |
chatHistory.push({role: 'user', content: message});
|
| 701 |
chatHistory.push({role: 'assistant', content: data.response || ''});
|
| 702 |
|
|
@@ -704,43 +244,36 @@
|
|
| 704 |
if (chatHistory.length > 20) {
|
| 705 |
chatHistory = chatHistory.slice(-20);
|
| 706 |
}
|
| 707 |
-
|
| 708 |
-
console.log('💾 Chat history updated, length:', chatHistory.length);
|
| 709 |
})
|
| 710 |
.catch(error => {
|
| 711 |
-
|
| 712 |
const loadingElement = document.getElementById(loadingId);
|
| 713 |
if (loadingElement) {
|
| 714 |
-
loadingElement.innerHTML = `
|
|
|
|
| 715 |
}
|
| 716 |
})
|
| 717 |
.finally(() => {
|
| 718 |
-
console.log('🔄 Re-enabling button');
|
| 719 |
// Re-enable button
|
| 720 |
button.disabled = false;
|
| 721 |
-
button.
|
| 722 |
-
button.innerHTML = '🚀 Analyze';
|
| 723 |
input.focus();
|
| 724 |
});
|
| 725 |
}
|
| 726 |
|
| 727 |
-
function
|
| 728 |
const chatContainer = document.getElementById('chat-messages');
|
| 729 |
const messageDiv = document.createElement('div');
|
| 730 |
const messageId = 'msg-' + Date.now() + '-' + Math.random().toString(36).substr(2, 9);
|
|
|
|
| 731 |
messageDiv.id = messageId;
|
| 732 |
messageDiv.className = `message ${role}`;
|
| 733 |
|
| 734 |
-
const
|
| 735 |
-
const roleName = role === 'user' ? 'You' : 'AEGIS CONDUCTOR';
|
| 736 |
|
| 737 |
messageDiv.innerHTML = `
|
| 738 |
-
<div class="message-header">
|
| 739 |
-
|
| 740 |
-
<span>${roleName}</span>
|
| 741 |
-
</div>
|
| 742 |
-
<div>${content.replace(/
|
| 743 |
-
/g, '<br>')}</div>
|
| 744 |
`;
|
| 745 |
|
| 746 |
chatContainer.appendChild(messageDiv);
|
|
@@ -749,8 +282,10 @@
|
|
| 749 |
return messageId;
|
| 750 |
}
|
| 751 |
|
| 752 |
-
//
|
| 753 |
-
|
|
|
|
|
|
|
| 754 |
</script>
|
| 755 |
</body>
|
| 756 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AEGIS BIO LAB 10 CONDUCTOR</title>
|
|
|
|
| 7 |
<style>
|
| 8 |
* {
|
| 9 |
margin: 0;
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
body {
|
| 15 |
+
font-family: Arial, sans-serif;
|
| 16 |
+
background: #1a1a1a;
|
| 17 |
color: #ffffff;
|
| 18 |
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
display: flex;
|
| 20 |
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
}
|
| 22 |
|
| 23 |
+
.header {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
text-align: center;
|
| 25 |
+
padding: 20px;
|
| 26 |
+
background: #2a2a2a;
|
| 27 |
+
border-bottom: 2px solid #00ff88;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
|
| 30 |
+
.header h1 {
|
| 31 |
font-size: 2em;
|
| 32 |
+
color: #00ff88;
|
| 33 |
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
+
.header p {
|
| 37 |
+
color: #cccccc;
|
| 38 |
+
font-size: 1.1em;
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
+
.chat-container {
|
| 42 |
+
flex: 1;
|
| 43 |
padding: 20px;
|
| 44 |
+
overflow-y: auto;
|
| 45 |
+
max-height: calc(100vh - 200px);
|
|
|
|
| 46 |
}
|
| 47 |
|
| 48 |
+
.message {
|
| 49 |
+
margin: 15px 0;
|
| 50 |
+
padding: 15px;
|
| 51 |
+
border-radius: 10px;
|
| 52 |
+
max-width: 80%;
|
| 53 |
}
|
| 54 |
|
| 55 |
.message.user {
|
| 56 |
+
background: #333333;
|
| 57 |
+
margin-left: auto;
|
| 58 |
text-align: right;
|
| 59 |
border-left: 4px solid #00ff88;
|
| 60 |
}
|
| 61 |
|
| 62 |
.message.assistant {
|
| 63 |
+
background: #2a2a2a;
|
|
|
|
| 64 |
border-left: 4px solid #00ccff;
|
| 65 |
}
|
| 66 |
|
| 67 |
.message-header {
|
| 68 |
+
font-weight: bold;
|
| 69 |
+
margin-bottom: 8px;
|
| 70 |
+
color: #00ff88;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
.input-container {
|
| 74 |
+
padding: 20px;
|
| 75 |
+
background: #2a2a2a;
|
| 76 |
+
border-top: 1px solid #444444;
|
| 77 |
display: flex;
|
| 78 |
+
gap: 10px;
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
.input-container input {
|
| 82 |
flex: 1;
|
| 83 |
+
padding: 15px;
|
| 84 |
+
border: 2px solid #444444;
|
| 85 |
+
border-radius: 8px;
|
| 86 |
+
background: #333333;
|
| 87 |
color: #ffffff;
|
| 88 |
font-size: 16px;
|
| 89 |
outline: none;
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
.input-container input:focus {
|
| 93 |
border-color: #00ff88;
|
|
|
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
.input-container input::placeholder {
|
| 97 |
+
color: #888888;
|
| 98 |
}
|
| 99 |
|
| 100 |
.send-button {
|
| 101 |
+
padding: 15px 25px;
|
| 102 |
border: none;
|
| 103 |
+
border-radius: 8px;
|
| 104 |
+
background: #00ff88;
|
| 105 |
+
color: #000000;
|
| 106 |
cursor: pointer;
|
| 107 |
font-size: 16px;
|
| 108 |
+
font-weight: bold;
|
| 109 |
+
transition: background 0.3s ease;
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
.send-button:hover {
|
| 113 |
+
background: #00cc66;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
|
| 116 |
.send-button:disabled {
|
| 117 |
+
background: #666666;
|
| 118 |
cursor: not-allowed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
+
.welcome-message {
|
| 122 |
+
text-align: center;
|
| 123 |
+
padding: 50px 20px;
|
| 124 |
+
color: #888888;
|
|
|
|
| 125 |
}
|
| 126 |
|
| 127 |
.loading {
|
| 128 |
+
color: #00ff88;
|
| 129 |
+
font-style: italic;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
}
|
| 131 |
|
| 132 |
+
.error {
|
| 133 |
+
color: #ff6666;
|
| 134 |
+
background: #331111;
|
| 135 |
+
border-left-color: #ff6666;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
@media (max-width: 768px) {
|
| 139 |
.header h1 {
|
| 140 |
+
font-size: 1.5em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
}
|
| 142 |
|
| 143 |
+
.message {
|
| 144 |
+
max-width: 95%;
|
| 145 |
}
|
| 146 |
|
| 147 |
.input-container {
|
|
|
|
| 151 |
</style>
|
| 152 |
</head>
|
| 153 |
<body>
|
| 154 |
+
<div class="header">
|
| 155 |
+
<h1>🧬 AEGIS BIO LAB 10 CONDUCTOR</h1>
|
| 156 |
+
<p>Multi-Domain Expert System powered by DeepSeek-V3.2-Exp</p>
|
| 157 |
+
</div>
|
| 158 |
|
| 159 |
+
<div class="chat-container" id="chat-messages">
|
| 160 |
+
<div class="welcome-message">
|
| 161 |
+
<h3>Welcome to AEGIS CONDUCTOR</h3>
|
| 162 |
+
<p>Ask me anything about economics, technology, security, health, environment, or strategy.</p>
|
| 163 |
+
<p>The system uses HuggingFace InferenceClient with automatic failover.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
</div>
|
| 165 |
</div>
|
| 166 |
+
|
| 167 |
+
<div class="input-container">
|
| 168 |
+
<input type="text" id="message-input" placeholder="Enter your question..." onkeypress="handleKeyPress(event)">
|
| 169 |
+
<button class="send-button" id="send-button" onclick="sendMessage()">Send</button>
|
| 170 |
+
</div>
|
| 171 |
|
| 172 |
<script>
|
| 173 |
let chatHistory = [];
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
function handleKeyPress(event) {
|
| 176 |
if (event.key === 'Enter') {
|
| 177 |
sendMessage();
|
| 178 |
}
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
function sendMessage() {
|
|
|
|
|
|
|
| 182 |
const input = document.getElementById('message-input');
|
| 183 |
+
const button = document.getElementById('send-button');
|
| 184 |
const message = input.value.trim();
|
| 185 |
|
|
|
|
|
|
|
| 186 |
if (!message) {
|
| 187 |
+
input.style.borderColor = '#ff6666';
|
|
|
|
|
|
|
| 188 |
setTimeout(() => {
|
| 189 |
+
input.style.borderColor = '#444444';
|
| 190 |
+
}, 1000);
|
| 191 |
return;
|
| 192 |
}
|
| 193 |
|
| 194 |
+
// Disable button
|
|
|
|
|
|
|
|
|
|
| 195 |
button.disabled = true;
|
| 196 |
+
button.textContent = 'Sending...';
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
// Clear welcome message
|
| 199 |
const welcomeMsg = document.querySelector('.welcome-message');
|
| 200 |
if (welcomeMsg) {
|
| 201 |
welcomeMsg.style.display = 'none';
|
|
|
|
| 202 |
}
|
| 203 |
|
| 204 |
// Add user message
|
| 205 |
+
addMessage('user', message);
|
| 206 |
input.value = '';
|
| 207 |
|
| 208 |
+
// Add loading message
|
| 209 |
+
const loadingId = addMessage('assistant', '<span class="loading">Analyzing...</span>');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
+
// Send request
|
| 212 |
fetch('/chat', {
|
| 213 |
method: 'POST',
|
| 214 |
headers: {
|
| 215 |
'Content-Type': 'application/json',
|
| 216 |
},
|
| 217 |
+
body: JSON.stringify({
|
| 218 |
+
message: message,
|
| 219 |
+
history: chatHistory,
|
| 220 |
+
analysis_type: 'general'
|
| 221 |
+
})
|
| 222 |
})
|
| 223 |
.then(response => {
|
|
|
|
|
|
|
| 224 |
if (!response.ok) {
|
| 225 |
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
| 226 |
}
|
| 227 |
return response.json();
|
| 228 |
})
|
| 229 |
.then(data => {
|
|
|
|
|
|
|
| 230 |
// Remove loading message
|
| 231 |
const loadingElement = document.getElementById(loadingId);
|
| 232 |
if (loadingElement) {
|
| 233 |
loadingElement.remove();
|
|
|
|
| 234 |
}
|
| 235 |
|
| 236 |
// Add response
|
| 237 |
+
addMessage('assistant', data.response || 'No response received');
|
| 238 |
|
| 239 |
+
// Update history
|
|
|
|
|
|
|
|
|
|
| 240 |
chatHistory.push({role: 'user', content: message});
|
| 241 |
chatHistory.push({role: 'assistant', content: data.response || ''});
|
| 242 |
|
|
|
|
| 244 |
if (chatHistory.length > 20) {
|
| 245 |
chatHistory = chatHistory.slice(-20);
|
| 246 |
}
|
|
|
|
|
|
|
| 247 |
})
|
| 248 |
.catch(error => {
|
| 249 |
+
// Remove loading message and show error
|
| 250 |
const loadingElement = document.getElementById(loadingId);
|
| 251 |
if (loadingElement) {
|
| 252 |
+
loadingElement.innerHTML = `<span class="error">Error: ${error.message}</span>`;
|
| 253 |
+
loadingElement.classList.add('error');
|
| 254 |
}
|
| 255 |
})
|
| 256 |
.finally(() => {
|
|
|
|
| 257 |
// Re-enable button
|
| 258 |
button.disabled = false;
|
| 259 |
+
button.textContent = 'Send';
|
|
|
|
| 260 |
input.focus();
|
| 261 |
});
|
| 262 |
}
|
| 263 |
|
| 264 |
+
function addMessage(role, content) {
|
| 265 |
const chatContainer = document.getElementById('chat-messages');
|
| 266 |
const messageDiv = document.createElement('div');
|
| 267 |
const messageId = 'msg-' + Date.now() + '-' + Math.random().toString(36).substr(2, 9);
|
| 268 |
+
|
| 269 |
messageDiv.id = messageId;
|
| 270 |
messageDiv.className = `message ${role}`;
|
| 271 |
|
| 272 |
+
const roleLabel = role === 'user' ? 'You' : 'AEGIS CONDUCTOR';
|
|
|
|
| 273 |
|
| 274 |
messageDiv.innerHTML = `
|
| 275 |
+
<div class="message-header">${roleLabel}</div>
|
| 276 |
+
<div>${content.replace(/\n/g, '<br>')}</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
`;
|
| 278 |
|
| 279 |
chatContainer.appendChild(messageDiv);
|
|
|
|
| 282 |
return messageId;
|
| 283 |
}
|
| 284 |
|
| 285 |
+
// Focus input on load
|
| 286 |
+
window.onload = function() {
|
| 287 |
+
document.getElementById('message-input').focus();
|
| 288 |
+
};
|
| 289 |
</script>
|
| 290 |
</body>
|
| 291 |
</html>
|