File size: 21,747 Bytes
d8c8177 e302529 d8c8177 e302529 d8c8177 aedcd48 d8c8177 f2d1de7 e302529 aedcd48 d8c8177 aedcd48 d8c8177 26ff8dc d8c8177 aedcd48 d8c8177 aedcd48 d8c8177 aedcd48 d8c8177 e302529 d8c8177 26ff8dc d8c8177 e302529 d8c8177 aedcd48 d8c8177 e302529 d8c8177 26ff8dc d8c8177 e302529 d8c8177 e302529 d8c8177 e302529 15f8db2 71c5f81 15f8db2 71c5f81 f2d1de7 e302529 26ff8dc f2d1de7 e302529 26ff8dc 71c5f81 e302529 a0035ba e302529 a0035ba 71c5f81 e302529 a0035ba e302529 71c5f81 e302529 71c5f81 e302529 71c5f81 e302529 71c5f81 e302529 71c5f81 a0035ba 71c5f81 e302529 71c5f81 e302529 71c5f81 e302529 a0035ba d8c8177 71c5f81 e302529 71c5f81 e302529 a0035ba 71c5f81 e302529 d8c8177 e302529 71c5f81 e302529 71c5f81 d8c8177 e302529 71c5f81 e302529 d8c8177 e302529 d8c8177 e302529 d8c8177 e302529 d8c8177 71c5f81 d8c8177 71c5f81 d8c8177 aedcd48 d8c8177 71c5f81 2954d4f 79ef842 e302529 2954d4f e302529 6bf34b8 e302529 6bf34b8 e302529 2954d4f e302529 d8c8177 e302529 2954d4f e302529 d8c8177 2954d4f d8c8177 79ef842 d8c8177 79ef842 d8c8177 79ef842 d8c8177 79ef842 d8c8177 79ef842 d8c8177 e302529 d8c8177 2954d4f 71c5f81 d8c8177 | 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 | # -*- coding: utf-8 -*-
"""FinGraph UI Templates and Styling Assets.
This module houses all custom CSS and HTML templates used by the main Gradio
application to keep the main app.py clean and readable.
"""
from typing import Any, Dict
# ββ λ¨μ νλ νΈ (Navy Blue) ββββββββββββββββββββββββββββββββββββββ
# μ£Ό ν
μ€νΈ: #1e3a5f / 보쑰: #3b5a82 / μ°ν: #6b8ab0
# κ°μ‘°(λ°μ΄μ¬λ ): #7c3aed / ν¬μΈνΈ ν
λ리: rgba(124,58,237,0.15)
# ββ 1. 컀μ€ν
CSS ββββββββββββββββββββββββββββββββββββββββββββββββ
CUSTOM_CSS: str = """
/* ββ Google Fonts λ‘λ ββ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500&family=Inter:wght@400;600&display=swap');
/* ββ μ 체 λ°°κ²½ / κΈ°λ³Έ ν°νΈ / νλ©΄ λλΉ νλ ββ */
body, .gradio-container {
background-color: #F6F5FA !important;
font-family: 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
color: #1e3a5f !important;
}
.gradio-container {
max-width: 1400px !important;
width: 95% !important;
margin: 0 auto !important;
}
/* ββ Ambient glow ββ */
.ambient-glow {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background:
radial-gradient(circle at 80% 10%, rgba(124,58,237,0.05) 0%, transparent 40%),
radial-gradient(circle at 20% 90%, rgba(12,217,247,0.05) 0%, transparent 40%);
z-index: -1;
pointer-events: none;
}
/* ββ μ¬μ΄λλ° μ 체 컨ν
μ΄λ ββ */
.sidebar-container {
border: 1px solid #e2e8f0 !important;
border-radius: 12px !important;
padding: 16px 16px !important;
background: #ffffff !important;
min-height: 700px !important;
height: 100% !important;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04) !important;
display: flex !important;
flex-direction: column !important;
justify-content: flex-start !important;
gap: 8px !important;
}
/* ββ ꡬλΆμ ββ */
.divider {
border: none;
border-top: 1px solid #e2e8f0;
margin: 6px 0 !important;
}
/* ββ ν¨λ λΌλ²¨ (μΉμ
μ λͺ©) ββ */
.panel-label {
font-size: 12.5px !important;
font-weight: 700;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.07em;
margin-bottom: 4px !important;
margin-top: 2px !important;
}
/* ββ μλ¨ 2 μΉ΄λ (κ°λ‘ λ°°μΉ) ββ */
.top-cards {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 4px !important;
}
.top-card {
background: #f8fafc !important;
border: 1px solid #e2e8f0 !important;
border-radius: 10px !important;
padding: 14px 14px 12px !important;
}
.top-card-lbl {
font-size: 11px;
font-weight: 600;
color: #64748b;
margin-bottom: 5px;
}
.top-card-val {
font-size: 22px;
font-weight: 800;
color: #1e293b;
line-height: 1.1;
}
.top-card-sub {
font-size: 10px;
color: #94a3b8;
margin-top: 3px;
}
/* ββ μΈμ¬μ΄νΈ ν ββ */
.insight-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 16px;
}
.insight-card {
background: #f0f4ff !important;
border: 1px solid #c7d2fe !important;
border-radius: 9px !important;
padding: 10px 12px !important;
}
.insight-lbl {
font-size: 10px;
font-weight: 700;
color: #6366f1;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 4px;
}
.insight-val {
font-size: 13px;
font-weight: 700;
color: #1e293b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* ββ μ£Όμ κΈ°μ ν€μλ λ°°μ§ (λ°°κ²½μ μμ, μ°ν λ³΄λΌ ν
μ€νΈ κ°νΈ) ββ */
.keyword-container {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 4px !important;
}
.keyword-badge {
display: inline-block;
background: transparent !important;
border: 1px solid #ddd6fe !important;
border-radius: 9999px !important;
padding: 4px 12px !important;
font-size: 12.5px !important;
font-weight: 600 !important;
color: #8b5cf6 !important;
}
.keyword-badge-first {
background: transparent !important;
color: #8b5cf6 !important;
border: 1px solid #ddd6fe !important;
}
/* ββ νμ¬ ν€μλ λ°°μ§ (ν€μλ λ°°μ§μ λμΌν μ, ν¬κΈ°, λ°°κ²½μμΌλ‘ ν΅μΌ) ββ */
.company-badge-container {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 4px !important;
}
.company-badge {
display: inline-block;
background: transparent !important;
border: 1px solid #ddd6fe !important;
border-radius: 9999px !important;
padding: 4px 12px !important;
font-size: 12.5px !important;
font-weight: 600 !important;
color: #8b5cf6 !important;
}
.company-badge-first {
background: transparent !important;
color: #8b5cf6 !important;
border: 1px solid #ddd6fe !important;
}
/* ββ μ΅μ λ΄μ€ νΌλ ββ */
.news-feed-container {
flex-grow: 1 !important;
max-height: 250px !important;
overflow-y: auto !important;
}
.news-feed-container::-webkit-scrollbar { width: 3px; }
.news-feed-container::-webkit-scrollbar-track { background: transparent; }
.news-feed-container::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 2px;
}
.news-item-link {
text-decoration: none;
display: block;
margin-bottom: 8px;
}
.news-item-link:last-child { margin-bottom: 0; }
.news-item {
border-left: 3px solid #6366f1 !important;
padding: 10px 12px !important;
background: #f8fafc !important;
border-radius: 0 8px 8px 0 !important;
transition: all 0.18s ease !important;
}
.news-item-link:hover .news-item {
background: #ffffff !important;
border-left-color: #06b6d4 !important;
transform: translateX(3px) !important;
box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}
.news-title {
font-size: 13px !important;
font-weight: 600 !important;
color: #1e293b !important;
line-height: 1.45 !important;
white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.news-meta {
font-size: 11px !important;
color: #94a3b8 !important;
margin-top: 4px;
}
/* ββ μ±λ΄ 컨ν
μ΄λ ν
λ리 μ κ±° ββ */
div[data-testid="chatbot"], .chatbot-container, .chatbot {
border: none !important;
}
/* ββ μ±λ΄ μμ λλΉ νλ λ° μ€μ μ λ ¬ ββ */
#chat-column {
display: flex !important;
flex-direction: column !important;
align-items: center !important;
width: 100% !important;
}
#chat-column > div,
#chat-column > .form {
width: 96% !important;
max-width: 100% !important;
margin: 0 auto !important;
display: flex !important;
flex-direction: column !important;
gap: 6px !important; /* μ»΄ν¬λνΈ κ° μμλ κ°κ²© μΆμ */
}
/* ββ μ±λ΄ λ΄λΆ Placeholder(μκ°κΈ μμ) ββ */
.placeholder, [class*="placeholder"] {
padding: 0 !important;
overflow: auto !important;
margin: 0 auto !important;
width: 100% !important;
max-width: 100% !important;
}
/* ββ μκ°κΈ(Prose) μ°μ»΄ 보λ (λ
립μ μΈ ν리미μ λΌμ΄λ μΉ΄λ ꡬ쑰) ββ */
.placeholder .prose {
background: #f8fafc !important;
border: 1px solid #e2e8f0 !important;
border-radius: 12px !important;
padding: 10px 14px !important; /* ν¨λ© μΆμ */
max-width: 100% !important;
width: 100% !important;
margin: 0 auto !important;
display: block !important;
position: relative !important;
z-index: 2 !important;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}
.placeholder h3, [class*="placeholder"] h3 {
color: #334155 !important;
font-weight: 800 !important;
font-size: 15px !important; /* ν°νΈ μ΄μ§ μΆμ */
margin-top: 0 !important;
margin-bottom: 6px !important;
}
.placeholder .prose ul {
list-style-type: none !important;
padding-left: 0 !important;
margin-bottom: 6px !important;
}
.placeholder .prose li {
margin-bottom: 2px !important; /* κ°κ²© μΆμ */
color: #475569 !important;
font-size: 13px !important;
line-height: 1.4 !important;
}
.placeholder .prose p {
font-size: 13px !important;
line-height: 1.4 !important;
margin-bottom: 4px !important;
}
.placeholder .prose p:last-child {
font-size: 12.5px !important;
font-weight: 700 !important;
color: #4c1d95 !important;
background: #f3e8ff !important;
padding: 4px 10px !important; /* ν¨λ© μΆμ */
border-radius: 6px !important;
display: inline-block !important;
margin-bottom: 0 !important;
}
/* ββ μμ μ§λ¬Έ 컨ν
μ΄λ (μμͺ½ 보λμ λμΌ λλΉλ‘ μ λ ¬λ λ
립 λΌμ΄λ μΉ΄λ) ββ */
[class*="examples"], .gr-samples-wrapper, .examples-container {
display: grid !important;
grid-template-columns: repeat(2, 1fr) !important;
gap: 6px !important; /* κ° μΆμ */
width: 100% !important;
max-width: 100% !important;
margin: 4px auto 6px auto !important; /* λ§μ§ μΆμ */
background: #f8fafc !important;
border: 1px solid #e2e8f0 !important;
border-radius: 12px !important;
padding: 10px 14px !important; /* ν¨λ© μΆμ */
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
position: relative !important;
z-index: 1 !important;
}
/* κ°λ³ λ²νΌ λμμΈ (μ°λ³΄λΌμ ν
λ§ & κ°λ ₯ν μ€μ μ λ ¬) */
.examples-container button, div[data-testid="chatbot"] button.example, button.example, .example-btn {
border-radius: 8px !important;
padding: 10px 12px !important;
text-align: center !important;
font-size: 13px !important;
font-weight: 600 !important;
color: #4c1d95 !important;
background: #f5f3ff !important;
background-color: #f5f3ff !important;
border: 1px solid #e9d5ff !important;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
transition: all 0.2s ease-in-out !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
min-height: 52px !important;
width: 100% !important;
white-space: normal !important;
}
.examples-container button:hover, div[data-testid="chatbot"] button.example:hover, button.example:hover, .example-btn:hover {
border-color: #a855f7 !important;
background: #f3e8ff !important;
background-color: #f3e8ff !important;
transform: translateY(-2px) !important;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08) !important;
color: #7c3aed !important;
}
/* ββ μ μ‘ λ²νΌ: λλΉ λκ³ λμ΄ μ
λ ₯μ°½μ λ§μΆ€ ββ */
button[class*="submit-btn"], #submit-btn, button[id*="submit"], button.submit-button {
background: linear-gradient(135deg, #1e3a5f 0%, #7c3aed 100%) !important;
color: white !important;
font-weight: 700 !important;
font-size: 13px !important;
border: none !important;
border-radius: 8px !important;
box-shadow: 0 2px 10px rgba(30,58,95,0.18) !important;
transition: all 0.16s ease !important;
cursor: pointer !important;
height: 46px !important;
min-width: 68px !important;
max-width: 88px !important;
padding: 0 16px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
box-sizing: border-box !important;
opacity: 1 !important;
visibility: visible !important;
}
button[class*="submit-btn"]:hover,
[data-testid="submit-button"]:hover {
background: linear-gradient(135deg, #2a4f82 0%, #8b47ff 100%) !important;
box-shadow: 0 4px 16px rgba(124,58,237,0.24) !important;
transform: translateY(-1px) !important;
}
/* ββ μ
λ ₯μ°½ ββ */
textarea,
[class*="input-container"] textarea,
[data-testid="textbox"] textarea {
height: 46px !important;
min-height: 46px !important;
max-height: 46px !important;
font-size: 13px !important;
padding: 14px 14px !important;
line-height: 1.5 !important;
border-radius: 8px !important;
border: 1px solid rgba(30,58,95,0.15) !important;
background: rgba(255,255,255,0.80) !important;
color: #1e3a5f !important;
resize: none !important;
overflow-y: hidden !important;
box-sizing: border-box !important;
}
textarea:focus {
border-color: #7c3aed !important;
background: rgba(255,255,255,0.97) !important;
box-shadow: 0 0 0 3px rgba(124,58,237,0.09) !important;
outline: none !important;
}
div:has(> button[class*="submit-btn"]),
div:has(> [data-testid="submit-button"]),
.input-container, [class*="input-container"] {
gap: 6px !important; /* κ° μΆμ */
align-items: center !important;
max-width: 100% !important;
width: 100% !important;
margin-left: 0 !important;
margin-right: 0 !important;
margin-top: 4px !important; /* μμλ κ°κ²© μ΅μ ν */
}
/* ββ μ±λ΄ ν/λΌλ²¨ μ¨κΉ ββ */
.chatbot-label, div[class*="chatbot"] .label,
[data-testid="chatbot"] .label, .chatbot-header,
.gr-panel-title, .gr-chatbot-label,
[data-testid="chatbot"] > label,
div[class*="chatbot"] > label,
label.svelte-1ipelgc, span.svelte-1ipelgc {
display: none !important;
}
/* ββ λ©μμ§ λ²λΈ κΈ°λ³Έ ν¬κΈ° μΆμ (μ¬μ©μ/λ΄ κ³΅ν΅ μΈλ‘ λμ΄ μ΅μ ν & 100% λΆλͺ¨ λλΉ μ±μ) ββ */
.message-wrap, .message-container, div[data-testid="chatbot"] .wrapper {
max-width: 100% !important;
width: 100% !important;
margin-left: 0 !important;
margin-right: 0 !important;
}
.message,
.message-wrap .message,
[data-testid="user-message"],
[data-testid="bot-message"] {
padding: 10px 14px !important;
min-height: auto !important;
}
/* ββ μ¬μ©μ λ²λΈ (λ€ν¬κ·Έλ μ΄ ν리미μ ν
λ§) ββ */
.message.user,
.message.user-message,
[data-testid="user-message"] {
background-color: #111827 !important;
border-radius: 12px 12px 0 12px !important;
padding: 10px 14px !important;
margin: 2px 0 !important;
border: none !important;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
color: #ffffff !important;
}
.message.user *,
.message.user-message *,
[data-testid="user-message"] * {
color: #ffffff !important;
line-height: 1.4 !important;
margin: 0 !important;
background: transparent !important;
}
/* ββ λ΄ λ²λΈ (νμ΄νΈ & κ·Έλ μ΄ κ²½κ³μ ν
λ§) ββ */
.message.bot,
.message.bot-message,
[data-testid="bot-message"] {
background-color: #ffffff !important;
color: #1f2937 !important;
border: 1px solid #e5e7eb !important;
border-radius: 12px 12px 12px 0 !important;
padding: 16px 20px !important;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}
.message.bot *,
.message.bot-message *,
[data-testid="bot-message"] * {
color: #1e3a5f !important;
background: transparent !important;
}
/* ββ λ©μμ§ λ΄λΆ μ¬λ°± μμ μ μ΄ ββ */
.message p, .message li,
[class*="message"] p, [class*="message"] li {
line-height: 1.55 !important;
margin: 0 !important;
margin-bottom: 6px !important;
padding: 0 !important;
border: none !important;
border-left: none !important;
box-shadow: none !important;
background: transparent !important;
color: #1e3a5f !important;
}
.message p:last-child, .message li:last-child {
margin-bottom: 0 !important;
}
.message blockquote, [class*="message"] blockquote {
border: none !important;
border-left: none !important;
padding: 0 !important;
margin: 0 !important;
background: transparent !important;
}
.message h3, [class*="message"] h3 {
margin-top: 14px !important;
margin-bottom: 6px !important;
font-weight: 800 !important;
color: #1e3a5f !important;
}
/* ββ μ μ λ§ν¬ / CSS λ³μ ββ */
:root {
--color-accent: #7c3aed !important;
--primary-500: #7c3aed !important;
--primary-600: #6d28d9 !important;
}
a { color: #7c3aed !important; }
/* ββ secondary λ²νΌ ββ */
button.secondary, button.lg.secondary, button.sm.secondary,
button.wrap, button.variant-secondary, .secondary-btn {
background-color: rgba(255,255,255,0.75) !important;
color: #1e3a5f !important;
border: 1px solid rgba(30,58,95,0.13) !important;
font-weight: 600 !important;
transition: all 0.16s ease !important;
}
button.secondary:hover, button.variant-secondary:hover {
background-color: rgba(255,255,255,0.97) !important;
border-color: rgba(124,58,237,0.24) !important;
}
/* ββ λ©μΈ λ μ΄μμ μ»¬λΌ λμ΄ λκΈ°ν ββ */
#main-row { align-items: stretch !important; }
#main-row > div[class*="column"] {
display: flex !important;
flex-direction: column !important;
}
/* ββ μΌμͺ½ ν¨λ λλΉ μ€λ²νλ‘μ° μμ μ°¨λ¨ ββ */
.sidebar-container * {
max-width: 100% !important;
box-sizing: border-box !important;
word-break: break-word !important;
overflow-wrap: break-word !important;
}
/* ββ μμ§ νΌλλ°± λ²νΌ μ¨κΉ ββ */
.feedback-area,
[data-testid="like-dislike"],
.like-dislike-area,
.message-buttons,
.chatbot-action-buttons,
button[aria-label="Good response"],
button[aria-label="Bad response"],
button[aria-label="thumbs up"],
button[aria-label="thumbs down"],
.bot + div > div > button,
.svelte-1ed2p3z { display: none !important; }
/* ββ Gradio 6.x Chatbot λ΄λΆ μ€λ²νλ‘μ° λ° μ€ν¬λ‘€λ° μ΅μ ν ββ */
div[data-testid="chatbot"] .message-wrap,
div[data-testid="chatbot"] .message-container,
div[data-testid="chatbot"] > div.wrapper,
div[data-testid="chatbot"] > div.scrollbar {
overflow-y: auto !important;
max-height: 600px !important;
}
/* ββ λͺ¨λ°μΌ νλ©΄ λμ: 800px μ΄νμμλ 100% λλΉ ββ */
@media (max-width: 800px) {
#chat-column > div,
#chat-column > .form {
width: 100% !important;
max-width: 100% !important;
}
[class*="examples"], .gr-samples-wrapper, .examples-container {
grid-template-columns: 1fr !important;
padding: 10px !important;
}
}
"""
def build_stats_html(stats: Dict[str, Any]) -> str:
"""μΌμͺ½ μ¬μ΄λλ° μ 체 HTML μμ±.
ꡬμ±:
- μλ¨ 2 μΉ΄λ (λΆμ λͺ¨λΈ / κΈ°μ΅μ)
- ꡬλΆμ
- νμ¬ ν€μλ λ°°μ§ (5κ°)
- ꡬλΆμ
- λ΄μ€ ν€μλ λ°°μ§
- ꡬλΆμ
- μ΅μ λ΄μ€ νΌλ
"""
# ββ νμ¬ ν€μλ λ°°μ§ (5κ°) βββββββββββββββββββββββββββ
company_html = ""
for idx, c in enumerate(stats.get("companies_list", [])):
css = "company-badge company-badge-first" if idx == 0 else "company-badge"
company_html += f'<span class="{css}"># {c["name"]}</span>\n'
if not company_html:
company_html = '<span style="font-size:10px;color:#6b8ab0;">λ±λ‘λ νμ¬ μμ</span>'
# ββ λ΄μ€ ν€μλ λ°°μ§ ββββββββββββββββββββββββββββββ
keyword_html = ""
for idx, t in enumerate(stats.get("techs_list", [])):
css = "keyword-badge keyword-badge-first" if idx == 0 else "keyword-badge"
keyword_html += f'<span class="{css}"># {t["name"]}</span>\n'
if not keyword_html:
keyword_html = '<span style="font-size:10px;color:#6b8ab0;">ν€μλ μμ</span>'
# ββ μ΅μ λ΄μ€ νΌλ ββββββββββββββββββββββββββββββ
news_html = ""
for a in stats.get("recent_articles", []):
title = a["title"] or ""
url = a["url"] if a["url"] and str(a["url"]).lower() != "nan" else "#"
target = 'target="_blank"' if url != "#" else ""
date_str = str(a["date"])[:10] if a["date"] else ""
news_html += f"""
<a class="news-item-link" href="{url}" {target}>
<div class="news-item">
<div class="news-title">{title}</div>
<div class="news-meta">{date_str}</div>
</div>
</a>"""
if not news_html:
news_html = '<div style="font-size:10px;color:#6b8ab0;">κΈ°μ¬λ₯Ό λΆλ¬μ€λ μ€...</div>'
return f"""
<div class="sidebar-container">
<!-- μλ¨ 2 μΉ΄λ -->
<div class="top-cards">
<div class="top-card">
<div class="top-card-lbl">π€ λΆμ λͺ¨λΈ</div>
<div class="top-card-val">GPT-4o</div>
<div class="top-card-sub">μ΄κ±°λ AI μμ§</div>
</div>
<div class="top-card">
<div class="top-card-lbl">π’ λμ κΈ°μ
</div>
<div class="top-card-val">{stats["companies"]}κ³³</div>
<div class="top-card-sub">κ·Έλν λ΄ κΈ°μ
</div>
</div>
</div>
<hr class="divider">
<!-- νμ¬ ν€μλ -->
<div class="panel-label">π’ μ£Όμ λμ κΈ°μ
</div>
<div class="company-badge-container">
{company_html}
</div>
<hr class="divider">
<!-- λ΄μ€ ν€μλ -->
<div class="panel-label">π·οΈ μ£Όμ κΈ°μ ν€μλ</div>
<div class="keyword-container">
{keyword_html}
</div>
<hr class="divider">
<!-- μ΅μ λ΄μ€ νΌλ -->
<div class="panel-label">π‘ μ΅μ λ΄μ€</div>
<div class="news-feed-container">
{news_html}
</div>
</div>
""" |