Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -251,20 +251,19 @@ Provide a thorough and helpful response. If suggesting code changes, provide com
|
|
| 251 |
# Initialize the copilot
|
| 252 |
copilot = CodingCopilot()
|
| 253 |
|
| 254 |
-
#
|
| 255 |
-
|
| 256 |
-
/*
|
| 257 |
-
* {
|
| 258 |
-
box-sizing: border-box;
|
| 259 |
-
}
|
| 260 |
-
|
| 261 |
.gradio-container {
|
| 262 |
-
max-width:
|
| 263 |
-
|
|
|
|
| 264 |
background: #0a0a0a !important;
|
| 265 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
|
| 266 |
color: #ffffff !important;
|
| 267 |
padding: 1rem !important;
|
|
|
|
|
|
|
| 268 |
}
|
| 269 |
|
| 270 |
/* Header Styles */
|
|
@@ -272,15 +271,15 @@ professional_css = """
|
|
| 272 |
background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 50%, #1a1a1a 100%) !important;
|
| 273 |
border: 1px solid #dc2626 !important;
|
| 274 |
border-radius: 16px !important;
|
| 275 |
-
padding:
|
| 276 |
-
margin-bottom:
|
| 277 |
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.15) !important;
|
| 278 |
text-align: center !important;
|
| 279 |
}
|
| 280 |
|
| 281 |
.header-title {
|
| 282 |
color: #ffffff !important;
|
| 283 |
-
font-size: 2.
|
| 284 |
font-weight: 700 !important;
|
| 285 |
margin: 0 !important;
|
| 286 |
background: linear-gradient(135deg, #ffffff 0%, #dc2626 100%) !important;
|
|
@@ -291,41 +290,76 @@ professional_css = """
|
|
| 291 |
|
| 292 |
.header-subtitle {
|
| 293 |
color: #a1a1aa !important;
|
| 294 |
-
font-size:
|
| 295 |
margin: 0.5rem 0 0 0 !important;
|
| 296 |
font-weight: 400 !important;
|
| 297 |
}
|
| 298 |
|
| 299 |
-
/*
|
| 300 |
-
.
|
| 301 |
display: flex !important;
|
|
|
|
| 302 |
gap: 1.5rem !important;
|
| 303 |
-
height:
|
|
|
|
| 304 |
align-items: stretch !important;
|
| 305 |
-
|
| 306 |
}
|
| 307 |
|
| 308 |
-
/*
|
| 309 |
-
.sidebar {
|
| 310 |
background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%) !important;
|
| 311 |
border: 1px solid #dc2626 !important;
|
| 312 |
border-radius: 16px !important;
|
| 313 |
-
padding:
|
| 314 |
-
width:
|
| 315 |
-
min-width:
|
| 316 |
-
max-width:
|
| 317 |
flex-shrink: 0 !important;
|
|
|
|
| 318 |
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.1) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
.sidebar-section {
|
| 322 |
-
margin-bottom:
|
| 323 |
}
|
| 324 |
|
| 325 |
.sidebar-title {
|
| 326 |
color: #dc2626 !important;
|
| 327 |
font-weight: 700 !important;
|
| 328 |
-
font-size: 1.
|
| 329 |
margin-bottom: 1rem !important;
|
| 330 |
text-transform: uppercase !important;
|
| 331 |
letter-spacing: 0.5px !important;
|
|
@@ -336,9 +370,8 @@ professional_css = """
|
|
| 336 |
|
| 337 |
.capabilities-list {
|
| 338 |
color: #d1d5db !important;
|
| 339 |
-
font-size: 0.
|
| 340 |
-
line-height: 1.
|
| 341 |
-
margin-bottom: 0 !important;
|
| 342 |
}
|
| 343 |
|
| 344 |
.capabilities-list strong {
|
|
@@ -362,104 +395,91 @@ professional_css = """
|
|
| 362 |
background: #1a1a1a !important;
|
| 363 |
color: #dc2626 !important;
|
| 364 |
border: 1px solid #dc2626 !important;
|
| 365 |
-
border-radius:
|
| 366 |
-
padding: 0.
|
| 367 |
font-weight: 500 !important;
|
| 368 |
cursor: pointer !important;
|
| 369 |
transition: all 0.3s ease !important;
|
| 370 |
-
margin-bottom: 0.
|
| 371 |
width: 100% !important;
|
| 372 |
text-align: left !important;
|
| 373 |
-
font-size: 0.
|
| 374 |
display: flex !important;
|
| 375 |
align-items: center !important;
|
| 376 |
-
gap: 0.
|
| 377 |
}
|
| 378 |
|
| 379 |
.quick-action-button:hover {
|
| 380 |
background: #dc2626 !important;
|
| 381 |
color: #ffffff !important;
|
| 382 |
-
transform: translateX(
|
| 383 |
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2) !important;
|
| 384 |
}
|
| 385 |
|
| 386 |
-
/* Chat Container
|
| 387 |
-
.chat-
|
| 388 |
-
background: linear-gradient(180deg, #111111 0%, #0a0a0a 100%) !important;
|
| 389 |
-
border: 1px solid #262626 !important;
|
| 390 |
-
border-radius: 16px !important;
|
| 391 |
flex: 1 !important;
|
| 392 |
display: flex !important;
|
| 393 |
flex-direction: column !important;
|
|
|
|
| 394 |
overflow: hidden !important;
|
| 395 |
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
| 396 |
-
min-height: 600px !important;
|
| 397 |
}
|
| 398 |
|
| 399 |
-
|
| 400 |
-
.chat-interface {
|
| 401 |
-
background: transparent !important;
|
| 402 |
-
border: none !important;
|
| 403 |
flex: 1 !important;
|
| 404 |
-
min-height: 400px !important;
|
| 405 |
-
max-height: 500px !important;
|
| 406 |
overflow-y: auto !important;
|
| 407 |
padding: 1rem !important;
|
|
|
|
| 408 |
}
|
| 409 |
|
| 410 |
-
.
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
|
|
|
| 414 |
}
|
| 415 |
|
| 416 |
-
/* File Upload
|
| 417 |
-
.file-upload-
|
| 418 |
background: #1a1a1a !important;
|
| 419 |
-
border: 1px
|
| 420 |
-
border-radius:
|
| 421 |
-
padding:
|
| 422 |
-
margin: 1rem !important;
|
| 423 |
transition: all 0.3s ease !important;
|
| 424 |
}
|
| 425 |
|
| 426 |
-
.file-upload-
|
| 427 |
border-color: #dc2626 !important;
|
| 428 |
background: #262626 !important;
|
| 429 |
}
|
| 430 |
|
| 431 |
-
/* Input
|
| 432 |
-
.input-section {
|
| 433 |
-
background: #1a1a1a !important;
|
| 434 |
-
border-top: 1px solid #262626 !important;
|
| 435 |
-
padding: 1rem !important;
|
| 436 |
-
margin-top: auto !important;
|
| 437 |
-
}
|
| 438 |
-
|
| 439 |
.message-input {
|
| 440 |
background: #262626 !important;
|
| 441 |
border: 1px solid #404040 !important;
|
| 442 |
-
border-radius:
|
| 443 |
color: #ffffff !important;
|
| 444 |
padding: 0.75rem !important;
|
| 445 |
-
font-size: 0.
|
| 446 |
line-height: 1.4 !important;
|
| 447 |
resize: vertical !important;
|
| 448 |
transition: all 0.3s ease !important;
|
| 449 |
width: 100% !important;
|
| 450 |
-
margin-bottom:
|
| 451 |
}
|
| 452 |
|
| 453 |
.message-input:focus {
|
| 454 |
outline: none !important;
|
| 455 |
border-color: #dc2626 !important;
|
| 456 |
-
box-shadow: 0 0 0
|
| 457 |
}
|
| 458 |
|
| 459 |
.message-input::placeholder {
|
| 460 |
color: #6b7280 !important;
|
| 461 |
}
|
| 462 |
|
|
|
|
| 463 |
.button-row {
|
| 464 |
display: flex !important;
|
| 465 |
gap: 0.75rem !important;
|
|
@@ -472,71 +492,57 @@ professional_css = """
|
|
| 472 |
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
|
| 473 |
color: white !important;
|
| 474 |
border: none !important;
|
| 475 |
-
border-radius:
|
| 476 |
-
padding: 0.
|
| 477 |
font-weight: 600 !important;
|
| 478 |
-
font-size: 0.
|
| 479 |
cursor: pointer !important;
|
| 480 |
transition: all 0.3s ease !important;
|
| 481 |
box-shadow: 0 4px 16px rgba(220, 38, 38, 0.2) !important;
|
| 482 |
text-transform: uppercase !important;
|
| 483 |
letter-spacing: 0.5px !important;
|
| 484 |
-
min-width:
|
| 485 |
}
|
| 486 |
|
| 487 |
.primary-button:hover {
|
| 488 |
background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
|
| 489 |
-
transform: translateY(-
|
| 490 |
-
box-shadow: 0
|
| 491 |
}
|
| 492 |
|
| 493 |
.secondary-button {
|
| 494 |
background: #262626 !important;
|
| 495 |
color: #ffffff !important;
|
| 496 |
border: 1px solid #404040 !important;
|
| 497 |
-
border-radius:
|
| 498 |
-
padding: 0.
|
| 499 |
font-weight: 500 !important;
|
| 500 |
cursor: pointer !important;
|
| 501 |
transition: all 0.3s ease !important;
|
| 502 |
text-transform: uppercase !important;
|
| 503 |
letter-spacing: 0.5px !important;
|
| 504 |
-
font-size: 0.
|
| 505 |
-
min-width:
|
| 506 |
}
|
| 507 |
|
| 508 |
.secondary-button:hover {
|
| 509 |
background: #404040 !important;
|
| 510 |
border-color: #dc2626 !important;
|
| 511 |
-
transform: translateY(-1px) !important;
|
| 512 |
}
|
| 513 |
|
| 514 |
/* Download Section */
|
| 515 |
.download-section {
|
| 516 |
background: #1a1a1a !important;
|
| 517 |
border: 1px solid #dc2626 !important;
|
| 518 |
-
border-radius:
|
| 519 |
-
padding:
|
| 520 |
-
margin: 1rem !important;
|
| 521 |
-
}
|
| 522 |
-
|
| 523 |
-
.download-title {
|
| 524 |
-
color: #dc2626 !important;
|
| 525 |
-
font-weight: 600 !important;
|
| 526 |
-
margin-bottom: 0.5rem !important;
|
| 527 |
-
font-size: 1rem !important;
|
| 528 |
-
}
|
| 529 |
-
|
| 530 |
-
/* Icons */
|
| 531 |
-
.emoji-icon {
|
| 532 |
-
font-size: 1.2rem !important;
|
| 533 |
-
margin-right: 0.3rem !important;
|
| 534 |
}
|
| 535 |
|
| 536 |
/* Scrollbar */
|
| 537 |
::-webkit-scrollbar {
|
| 538 |
-
width:
|
| 539 |
-
height:
|
| 540 |
}
|
| 541 |
|
| 542 |
::-webkit-scrollbar-track {
|
|
@@ -545,78 +551,54 @@ professional_css = """
|
|
| 545 |
|
| 546 |
::-webkit-scrollbar-thumb {
|
| 547 |
background: #404040 !important;
|
| 548 |
-
border-radius:
|
| 549 |
}
|
| 550 |
|
| 551 |
::-webkit-scrollbar-thumb:hover {
|
| 552 |
background: #dc2626 !important;
|
| 553 |
}
|
| 554 |
|
| 555 |
-
/*
|
| 556 |
-
@media (
|
| 557 |
-
.
|
| 558 |
-
flex-direction:
|
| 559 |
-
}
|
| 560 |
-
|
| 561 |
-
.sidebar {
|
| 562 |
-
width: 100% !important;
|
| 563 |
-
min-width: auto !important;
|
| 564 |
-
max-width: none !important;
|
| 565 |
-
order: 2 !important;
|
| 566 |
-
}
|
| 567 |
-
|
| 568 |
-
.chat-container {
|
| 569 |
-
order: 1 !important;
|
| 570 |
-
}
|
| 571 |
-
}
|
| 572 |
-
|
| 573 |
-
@media (max-width: 768px) {
|
| 574 |
-
.gradio-container {
|
| 575 |
-
padding: 0.5rem !important;
|
| 576 |
-
}
|
| 577 |
-
|
| 578 |
-
.header-title {
|
| 579 |
-
font-size: 2rem !important;
|
| 580 |
-
}
|
| 581 |
-
|
| 582 |
-
.sidebar {
|
| 583 |
-
padding: 1rem !important;
|
| 584 |
}
|
| 585 |
|
| 586 |
-
.
|
| 587 |
-
|
| 588 |
-
|
|
|
|
| 589 |
}
|
| 590 |
|
| 591 |
-
.
|
| 592 |
-
|
| 593 |
}
|
| 594 |
}
|
| 595 |
|
| 596 |
-
/* Animations */
|
| 597 |
-
@keyframes fadeIn {
|
| 598 |
-
from { opacity: 0; transform: translateY(10px); }
|
| 599 |
-
to { opacity: 1; transform: translateY(0); }
|
| 600 |
-
}
|
| 601 |
-
|
| 602 |
-
.chat-message {
|
| 603 |
-
animation: fadeIn 0.3s ease-out !important;
|
| 604 |
-
}
|
| 605 |
-
|
| 606 |
/* Footer */
|
| 607 |
.footer {
|
| 608 |
background: #0a0a0a !important;
|
| 609 |
border-top: 1px solid #262626 !important;
|
| 610 |
-
padding:
|
| 611 |
text-align: center !important;
|
| 612 |
color: #6b7280 !important;
|
| 613 |
-
margin-top:
|
| 614 |
-
border-radius:
|
|
|
|
| 615 |
}
|
| 616 |
|
| 617 |
.footer strong {
|
| 618 |
color: #dc2626 !important;
|
| 619 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
"""
|
| 621 |
|
| 622 |
def process_chat_message(message, files, history):
|
|
@@ -653,8 +635,8 @@ def quick_action(action_text):
|
|
| 653 |
"""Handle quick action buttons."""
|
| 654 |
return action_text
|
| 655 |
|
| 656 |
-
# Create the main interface
|
| 657 |
-
with gr.Blocks(css=
|
| 658 |
|
| 659 |
# Header
|
| 660 |
gr.HTML("""
|
|
@@ -664,14 +646,13 @@ with gr.Blocks(css=professional_css, title="Coding Copilot Pro", theme=gr.themes
|
|
| 664 |
</div>
|
| 665 |
""")
|
| 666 |
|
| 667 |
-
#
|
| 668 |
-
with gr.Row(elem_classes=["
|
| 669 |
|
| 670 |
-
# Left Sidebar -
|
| 671 |
-
with gr.Column(elem_classes=["sidebar"], scale=0):
|
| 672 |
|
| 673 |
# Capabilities Section
|
| 674 |
-
gr.HTML('<div class="sidebar-section">')
|
| 675 |
gr.HTML('<h3 class="sidebar-title"><span class="emoji-icon">π―</span>CAPABILITIES</h3>')
|
| 676 |
|
| 677 |
gr.HTML("""
|
|
@@ -694,62 +675,60 @@ with gr.Blocks(css=professional_css, title="Coding Copilot Pro", theme=gr.themes
|
|
| 694 |
</div>
|
| 695 |
</div>
|
| 696 |
""")
|
| 697 |
-
gr.HTML('</div>')
|
| 698 |
|
| 699 |
# Quick Actions Section
|
| 700 |
-
gr.HTML('<div class="sidebar-section">')
|
| 701 |
gr.HTML('<h3 class="sidebar-title"><span class="emoji-icon">β‘</span>QUICK ACTIONS</h3>')
|
| 702 |
|
| 703 |
-
quick_review = gr.Button("π
|
| 704 |
quick_debug = gr.Button("π Debug & Fix", elem_classes=["quick-action-button"])
|
| 705 |
-
quick_optimize = gr.Button("β‘ Optimize
|
| 706 |
-
quick_explain = gr.Button("π Explain
|
| 707 |
-
quick_generate = gr.Button("π₯ Generate
|
| 708 |
quick_test = gr.Button("π§ͺ Create Tests", elem_classes=["quick-action-button"])
|
| 709 |
-
|
| 710 |
-
gr.HTML('</div>')
|
| 711 |
|
| 712 |
-
# Right Chat Container -
|
| 713 |
-
with gr.Column(elem_classes=["
|
| 714 |
-
|
| 715 |
-
# Chat interface
|
| 716 |
-
chatbot = gr.Chatbot(
|
| 717 |
-
height=400,
|
| 718 |
-
show_label=False,
|
| 719 |
-
container=False,
|
| 720 |
-
bubble_full_width=False,
|
| 721 |
-
avatar_images=("π¨βπ»", "π€"),
|
| 722 |
-
elem_classes=["chat-interface"]
|
| 723 |
-
)
|
| 724 |
-
|
| 725 |
-
# File upload section
|
| 726 |
-
with gr.Row(elem_classes=["file-upload-section"]):
|
| 727 |
-
files = gr.File(
|
| 728 |
-
label="π Upload Code Files (.py, .ipynb)",
|
| 729 |
-
file_count="multiple",
|
| 730 |
-
file_types=[".py", ".ipynb"],
|
| 731 |
-
show_label=True,
|
| 732 |
-
container=True
|
| 733 |
-
)
|
| 734 |
-
|
| 735 |
-
# Download section
|
| 736 |
-
download_status = gr.HTML("", visible=True)
|
| 737 |
-
download_file = gr.File(label="π₯ Download Generated Code", visible=False)
|
| 738 |
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
|
| 742 |
-
|
| 743 |
-
placeholder="Describe what you want to build, analyze, or improve... Type 'continue' to extend previous code.",
|
| 744 |
show_label=False,
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
|
|
|
| 748 |
)
|
| 749 |
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
|
| 754 |
# Hidden state
|
| 755 |
chat_history = gr.State([])
|
|
|
|
| 251 |
# Initialize the copilot
|
| 252 |
copilot = CodingCopilot()
|
| 253 |
|
| 254 |
+
# Fixed Desktop Layout CSS
|
| 255 |
+
desktop_css = """
|
| 256 |
+
/* Force desktop layout */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
.gradio-container {
|
| 258 |
+
max-width: none !important;
|
| 259 |
+
width: 100vw !important;
|
| 260 |
+
height: 100vh !important;
|
| 261 |
background: #0a0a0a !important;
|
| 262 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
|
| 263 |
color: #ffffff !important;
|
| 264 |
padding: 1rem !important;
|
| 265 |
+
box-sizing: border-box !important;
|
| 266 |
+
overflow: hidden !important;
|
| 267 |
}
|
| 268 |
|
| 269 |
/* Header Styles */
|
|
|
|
| 271 |
background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 50%, #1a1a1a 100%) !important;
|
| 272 |
border: 1px solid #dc2626 !important;
|
| 273 |
border-radius: 16px !important;
|
| 274 |
+
padding: 1.5rem !important;
|
| 275 |
+
margin-bottom: 1rem !important;
|
| 276 |
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.15) !important;
|
| 277 |
text-align: center !important;
|
| 278 |
}
|
| 279 |
|
| 280 |
.header-title {
|
| 281 |
color: #ffffff !important;
|
| 282 |
+
font-size: 2.2rem !important;
|
| 283 |
font-weight: 700 !important;
|
| 284 |
margin: 0 !important;
|
| 285 |
background: linear-gradient(135deg, #ffffff 0%, #dc2626 100%) !important;
|
|
|
|
| 290 |
|
| 291 |
.header-subtitle {
|
| 292 |
color: #a1a1aa !important;
|
| 293 |
+
font-size: 1rem !important;
|
| 294 |
margin: 0.5rem 0 0 0 !important;
|
| 295 |
font-weight: 400 !important;
|
| 296 |
}
|
| 297 |
|
| 298 |
+
/* FORCE DESKTOP LAYOUT - Critical CSS */
|
| 299 |
+
.desktop-layout {
|
| 300 |
display: flex !important;
|
| 301 |
+
flex-direction: row !important;
|
| 302 |
gap: 1.5rem !important;
|
| 303 |
+
height: calc(100vh - 200px) !important;
|
| 304 |
+
width: 100% !important;
|
| 305 |
align-items: stretch !important;
|
| 306 |
+
min-height: 600px !important;
|
| 307 |
}
|
| 308 |
|
| 309 |
+
/* Force sidebar to stay on left */
|
| 310 |
+
.desktop-sidebar {
|
| 311 |
background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%) !important;
|
| 312 |
border: 1px solid #dc2626 !important;
|
| 313 |
border-radius: 16px !important;
|
| 314 |
+
padding: 1.5rem !important;
|
| 315 |
+
width: 320px !important;
|
| 316 |
+
min-width: 320px !important;
|
| 317 |
+
max-width: 320px !important;
|
| 318 |
flex-shrink: 0 !important;
|
| 319 |
+
flex-grow: 0 !important;
|
| 320 |
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.1) !important;
|
| 321 |
+
overflow-y: auto !important;
|
| 322 |
+
height: 100% !important;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
/* Force chat to stay on right and take remaining space */
|
| 326 |
+
.desktop-chat {
|
| 327 |
+
background: linear-gradient(180deg, #111111 0%, #0a0a0a 100%) !important;
|
| 328 |
+
border: 1px solid #262626 !important;
|
| 329 |
+
border-radius: 16px !important;
|
| 330 |
+
flex: 1 !important;
|
| 331 |
+
flex-grow: 1 !important;
|
| 332 |
+
flex-shrink: 1 !important;
|
| 333 |
+
display: flex !important;
|
| 334 |
+
flex-direction: column !important;
|
| 335 |
+
overflow: hidden !important;
|
| 336 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
| 337 |
+
height: 100% !important;
|
| 338 |
+
min-width: 0 !important;
|
| 339 |
}
|
| 340 |
|
| 341 |
+
/* Override Gradio's column behavior */
|
| 342 |
+
.desktop-layout > .block:first-child {
|
| 343 |
+
width: 320px !important;
|
| 344 |
+
min-width: 320px !important;
|
| 345 |
+
max-width: 320px !important;
|
| 346 |
+
flex: none !important;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
.desktop-layout > .block:last-child {
|
| 350 |
+
flex: 1 !important;
|
| 351 |
+
min-width: 0 !important;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
/* Sidebar content */
|
| 355 |
.sidebar-section {
|
| 356 |
+
margin-bottom: 1.5rem !important;
|
| 357 |
}
|
| 358 |
|
| 359 |
.sidebar-title {
|
| 360 |
color: #dc2626 !important;
|
| 361 |
font-weight: 700 !important;
|
| 362 |
+
font-size: 1.1rem !important;
|
| 363 |
margin-bottom: 1rem !important;
|
| 364 |
text-transform: uppercase !important;
|
| 365 |
letter-spacing: 0.5px !important;
|
|
|
|
| 370 |
|
| 371 |
.capabilities-list {
|
| 372 |
color: #d1d5db !important;
|
| 373 |
+
font-size: 0.85rem !important;
|
| 374 |
+
line-height: 1.5 !important;
|
|
|
|
| 375 |
}
|
| 376 |
|
| 377 |
.capabilities-list strong {
|
|
|
|
| 395 |
background: #1a1a1a !important;
|
| 396 |
color: #dc2626 !important;
|
| 397 |
border: 1px solid #dc2626 !important;
|
| 398 |
+
border-radius: 8px !important;
|
| 399 |
+
padding: 0.6rem 0.8rem !important;
|
| 400 |
font-weight: 500 !important;
|
| 401 |
cursor: pointer !important;
|
| 402 |
transition: all 0.3s ease !important;
|
| 403 |
+
margin-bottom: 0.4rem !important;
|
| 404 |
width: 100% !important;
|
| 405 |
text-align: left !important;
|
| 406 |
+
font-size: 0.8rem !important;
|
| 407 |
display: flex !important;
|
| 408 |
align-items: center !important;
|
| 409 |
+
gap: 0.4rem !important;
|
| 410 |
}
|
| 411 |
|
| 412 |
.quick-action-button:hover {
|
| 413 |
background: #dc2626 !important;
|
| 414 |
color: #ffffff !important;
|
| 415 |
+
transform: translateX(3px) !important;
|
| 416 |
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2) !important;
|
| 417 |
}
|
| 418 |
|
| 419 |
+
/* Chat Container Layout */
|
| 420 |
+
.chat-main {
|
|
|
|
|
|
|
|
|
|
| 421 |
flex: 1 !important;
|
| 422 |
display: flex !important;
|
| 423 |
flex-direction: column !important;
|
| 424 |
+
height: 100% !important;
|
| 425 |
overflow: hidden !important;
|
|
|
|
|
|
|
| 426 |
}
|
| 427 |
|
| 428 |
+
.chat-messages {
|
|
|
|
|
|
|
|
|
|
| 429 |
flex: 1 !important;
|
|
|
|
|
|
|
| 430 |
overflow-y: auto !important;
|
| 431 |
padding: 1rem !important;
|
| 432 |
+
height: 0 !important; /* Force flex child to respect parent height */
|
| 433 |
}
|
| 434 |
|
| 435 |
+
.chat-input-area {
|
| 436 |
+
flex-shrink: 0 !important;
|
| 437 |
+
background: #1a1a1a !important;
|
| 438 |
+
border-top: 1px solid #262626 !important;
|
| 439 |
+
padding: 1rem !important;
|
| 440 |
}
|
| 441 |
|
| 442 |
+
/* File Upload Styling */
|
| 443 |
+
.file-upload-area {
|
| 444 |
background: #1a1a1a !important;
|
| 445 |
+
border: 1px dashed #404040 !important;
|
| 446 |
+
border-radius: 8px !important;
|
| 447 |
+
padding: 0.8rem !important;
|
| 448 |
+
margin-bottom: 1rem !important;
|
| 449 |
transition: all 0.3s ease !important;
|
| 450 |
}
|
| 451 |
|
| 452 |
+
.file-upload-area:hover {
|
| 453 |
border-color: #dc2626 !important;
|
| 454 |
background: #262626 !important;
|
| 455 |
}
|
| 456 |
|
| 457 |
+
/* Input Styling */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
.message-input {
|
| 459 |
background: #262626 !important;
|
| 460 |
border: 1px solid #404040 !important;
|
| 461 |
+
border-radius: 8px !important;
|
| 462 |
color: #ffffff !important;
|
| 463 |
padding: 0.75rem !important;
|
| 464 |
+
font-size: 0.9rem !important;
|
| 465 |
line-height: 1.4 !important;
|
| 466 |
resize: vertical !important;
|
| 467 |
transition: all 0.3s ease !important;
|
| 468 |
width: 100% !important;
|
| 469 |
+
margin-bottom: 0.8rem !important;
|
| 470 |
}
|
| 471 |
|
| 472 |
.message-input:focus {
|
| 473 |
outline: none !important;
|
| 474 |
border-color: #dc2626 !important;
|
| 475 |
+
box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1) !important;
|
| 476 |
}
|
| 477 |
|
| 478 |
.message-input::placeholder {
|
| 479 |
color: #6b7280 !important;
|
| 480 |
}
|
| 481 |
|
| 482 |
+
/* Button Row */
|
| 483 |
.button-row {
|
| 484 |
display: flex !important;
|
| 485 |
gap: 0.75rem !important;
|
|
|
|
| 492 |
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
|
| 493 |
color: white !important;
|
| 494 |
border: none !important;
|
| 495 |
+
border-radius: 8px !important;
|
| 496 |
+
padding: 0.7rem 1.2rem !important;
|
| 497 |
font-weight: 600 !important;
|
| 498 |
+
font-size: 0.85rem !important;
|
| 499 |
cursor: pointer !important;
|
| 500 |
transition: all 0.3s ease !important;
|
| 501 |
box-shadow: 0 4px 16px rgba(220, 38, 38, 0.2) !important;
|
| 502 |
text-transform: uppercase !important;
|
| 503 |
letter-spacing: 0.5px !important;
|
| 504 |
+
min-width: 70px !important;
|
| 505 |
}
|
| 506 |
|
| 507 |
.primary-button:hover {
|
| 508 |
background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
|
| 509 |
+
transform: translateY(-1px) !important;
|
| 510 |
+
box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3) !important;
|
| 511 |
}
|
| 512 |
|
| 513 |
.secondary-button {
|
| 514 |
background: #262626 !important;
|
| 515 |
color: #ffffff !important;
|
| 516 |
border: 1px solid #404040 !important;
|
| 517 |
+
border-radius: 8px !important;
|
| 518 |
+
padding: 0.7rem 1.2rem !important;
|
| 519 |
font-weight: 500 !important;
|
| 520 |
cursor: pointer !important;
|
| 521 |
transition: all 0.3s ease !important;
|
| 522 |
text-transform: uppercase !important;
|
| 523 |
letter-spacing: 0.5px !important;
|
| 524 |
+
font-size: 0.85rem !important;
|
| 525 |
+
min-width: 70px !important;
|
| 526 |
}
|
| 527 |
|
| 528 |
.secondary-button:hover {
|
| 529 |
background: #404040 !important;
|
| 530 |
border-color: #dc2626 !important;
|
|
|
|
| 531 |
}
|
| 532 |
|
| 533 |
/* Download Section */
|
| 534 |
.download-section {
|
| 535 |
background: #1a1a1a !important;
|
| 536 |
border: 1px solid #dc2626 !important;
|
| 537 |
+
border-radius: 8px !important;
|
| 538 |
+
padding: 0.8rem !important;
|
| 539 |
+
margin-bottom: 1rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 540 |
}
|
| 541 |
|
| 542 |
/* Scrollbar */
|
| 543 |
::-webkit-scrollbar {
|
| 544 |
+
width: 4px !important;
|
| 545 |
+
height: 4px !important;
|
| 546 |
}
|
| 547 |
|
| 548 |
::-webkit-scrollbar-track {
|
|
|
|
| 551 |
|
| 552 |
::-webkit-scrollbar-thumb {
|
| 553 |
background: #404040 !important;
|
| 554 |
+
border-radius: 2px !important;
|
| 555 |
}
|
| 556 |
|
| 557 |
::-webkit-scrollbar-thumb:hover {
|
| 558 |
background: #dc2626 !important;
|
| 559 |
}
|
| 560 |
|
| 561 |
+
/* Force no mobile responsiveness for desktop view */
|
| 562 |
+
@media (min-width: 1px) {
|
| 563 |
+
.desktop-layout {
|
| 564 |
+
flex-direction: row !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
}
|
| 566 |
|
| 567 |
+
.desktop-sidebar {
|
| 568 |
+
width: 320px !important;
|
| 569 |
+
min-width: 320px !important;
|
| 570 |
+
max-width: 320px !important;
|
| 571 |
}
|
| 572 |
|
| 573 |
+
.desktop-chat {
|
| 574 |
+
flex: 1 !important;
|
| 575 |
}
|
| 576 |
}
|
| 577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
/* Footer */
|
| 579 |
.footer {
|
| 580 |
background: #0a0a0a !important;
|
| 581 |
border-top: 1px solid #262626 !important;
|
| 582 |
+
padding: 1rem !important;
|
| 583 |
text-align: center !important;
|
| 584 |
color: #6b7280 !important;
|
| 585 |
+
margin-top: 1rem !important;
|
| 586 |
+
border-radius: 8px !important;
|
| 587 |
+
font-size: 0.8rem !important;
|
| 588 |
}
|
| 589 |
|
| 590 |
.footer strong {
|
| 591 |
color: #dc2626 !important;
|
| 592 |
}
|
| 593 |
+
|
| 594 |
+
/* Override any Gradio responsive behavior */
|
| 595 |
+
.gradio-container .block {
|
| 596 |
+
width: auto !important;
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
.gradio-container .contain {
|
| 600 |
+
padding: 0 !important;
|
| 601 |
+
}
|
| 602 |
"""
|
| 603 |
|
| 604 |
def process_chat_message(message, files, history):
|
|
|
|
| 635 |
"""Handle quick action buttons."""
|
| 636 |
return action_text
|
| 637 |
|
| 638 |
+
# Create the main interface with FORCED desktop layout
|
| 639 |
+
with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.themes.Base()) as app:
|
| 640 |
|
| 641 |
# Header
|
| 642 |
gr.HTML("""
|
|
|
|
| 646 |
</div>
|
| 647 |
""")
|
| 648 |
|
| 649 |
+
# FORCE Desktop Layout - Critical Structure
|
| 650 |
+
with gr.Row(elem_classes=["desktop-layout"]):
|
| 651 |
|
| 652 |
+
# Left Sidebar - FORCED width and position
|
| 653 |
+
with gr.Column(elem_classes=["desktop-sidebar"], scale=0, min_width=320):
|
| 654 |
|
| 655 |
# Capabilities Section
|
|
|
|
| 656 |
gr.HTML('<h3 class="sidebar-title"><span class="emoji-icon">π―</span>CAPABILITIES</h3>')
|
| 657 |
|
| 658 |
gr.HTML("""
|
|
|
|
| 675 |
</div>
|
| 676 |
</div>
|
| 677 |
""")
|
|
|
|
| 678 |
|
| 679 |
# Quick Actions Section
|
|
|
|
| 680 |
gr.HTML('<h3 class="sidebar-title"><span class="emoji-icon">β‘</span>QUICK ACTIONS</h3>')
|
| 681 |
|
| 682 |
+
quick_review = gr.Button("π Code Review", elem_classes=["quick-action-button"])
|
| 683 |
quick_debug = gr.Button("π Debug & Fix", elem_classes=["quick-action-button"])
|
| 684 |
+
quick_optimize = gr.Button("β‘ Optimize", elem_classes=["quick-action-button"])
|
| 685 |
+
quick_explain = gr.Button("π Explain", elem_classes=["quick-action-button"])
|
| 686 |
+
quick_generate = gr.Button("π₯ Generate", elem_classes=["quick-action-button"])
|
| 687 |
quick_test = gr.Button("π§ͺ Create Tests", elem_classes=["quick-action-button"])
|
|
|
|
|
|
|
| 688 |
|
| 689 |
+
# Right Chat Container - FORCED to take remaining space
|
| 690 |
+
with gr.Column(elem_classes=["desktop-chat"], scale=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 691 |
|
| 692 |
+
with gr.Column(elem_classes=["chat-main"]):
|
| 693 |
+
# Chat messages area
|
| 694 |
+
chatbot = gr.Chatbot(
|
| 695 |
+
height=400,
|
|
|
|
| 696 |
show_label=False,
|
| 697 |
+
container=False,
|
| 698 |
+
bubble_full_width=False,
|
| 699 |
+
avatar_images=("π¨βπ»", "π€"),
|
| 700 |
+
elem_classes=["chat-messages"]
|
| 701 |
)
|
| 702 |
|
| 703 |
+
# Input area at bottom
|
| 704 |
+
with gr.Column(elem_classes=["chat-input-area"]):
|
| 705 |
+
# File upload
|
| 706 |
+
files = gr.File(
|
| 707 |
+
label="π Upload Code Files (.py, .ipynb)",
|
| 708 |
+
file_count="multiple",
|
| 709 |
+
file_types=[".py", ".ipynb"],
|
| 710 |
+
container=True,
|
| 711 |
+
elem_classes=["file-upload-area"]
|
| 712 |
+
)
|
| 713 |
+
|
| 714 |
+
# Download status
|
| 715 |
+
download_status = gr.HTML("", visible=True)
|
| 716 |
+
download_file = gr.File(label="π₯ Download Generated Code", visible=False)
|
| 717 |
+
|
| 718 |
+
# Message input
|
| 719 |
+
msg = gr.Textbox(
|
| 720 |
+
label="",
|
| 721 |
+
placeholder="Describe what you want to build, analyze, or improve... Type 'continue' to extend previous code.",
|
| 722 |
+
show_label=False,
|
| 723 |
+
lines=2,
|
| 724 |
+
max_lines=4,
|
| 725 |
+
elem_classes=["message-input"]
|
| 726 |
+
)
|
| 727 |
+
|
| 728 |
+
# Button row
|
| 729 |
+
with gr.Row(elem_classes=["button-row"]):
|
| 730 |
+
clear = gr.Button("CLEAR", variant="secondary", elem_classes=["secondary-button"])
|
| 731 |
+
submit = gr.Button("SEND", variant="primary", elem_classes=["primary-button"])
|
| 732 |
|
| 733 |
# Hidden state
|
| 734 |
chat_history = gr.State([])
|