Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -251,9 +251,9 @@ Provide a thorough and helpful response. If suggesting code changes, provide com
|
|
| 251 |
# Initialize the copilot
|
| 252 |
copilot = CodingCopilot()
|
| 253 |
|
| 254 |
-
#
|
| 255 |
desktop_css = """
|
| 256 |
-
/*
|
| 257 |
.gradio-container {
|
| 258 |
max-width: none !important;
|
| 259 |
width: 100vw !important;
|
|
@@ -263,10 +263,9 @@ desktop_css = """
|
|
| 263 |
color: #ffffff !important;
|
| 264 |
padding: 1rem !important;
|
| 265 |
box-sizing: border-box !important;
|
| 266 |
-
overflow: hidden !important;
|
| 267 |
}
|
| 268 |
|
| 269 |
-
/* Header
|
| 270 |
.header-container {
|
| 271 |
background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 50%, #1a1a1a 100%) !important;
|
| 272 |
border: 1px solid #dc2626 !important;
|
|
@@ -295,19 +294,17 @@ desktop_css = """
|
|
| 295 |
font-weight: 400 !important;
|
| 296 |
}
|
| 297 |
|
| 298 |
-
/*
|
| 299 |
-
.
|
| 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: 700px !important;
|
| 307 |
}
|
| 308 |
|
| 309 |
-
/*
|
| 310 |
-
.
|
| 311 |
background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%) !important;
|
| 312 |
border: 1px solid #dc2626 !important;
|
| 313 |
border-radius: 16px !important;
|
|
@@ -316,182 +313,50 @@ desktop_css = """
|
|
| 316 |
min-width: 350px !important;
|
| 317 |
max-width: 350px !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 |
-
display: flex !important;
|
| 324 |
-
flex-direction: column !important;
|
| 325 |
}
|
| 326 |
|
| 327 |
-
/*
|
| 328 |
-
.
|
| 329 |
background: linear-gradient(180deg, #111111 0%, #0a0a0a 100%) !important;
|
| 330 |
border: 1px solid #262626 !important;
|
| 331 |
border-radius: 16px !important;
|
| 332 |
flex: 1 !important;
|
| 333 |
-
flex-grow: 1 !important;
|
| 334 |
-
flex-shrink: 1 !important;
|
| 335 |
display: flex !important;
|
| 336 |
flex-direction: column !important;
|
| 337 |
overflow: hidden !important;
|
| 338 |
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
| 339 |
height: 100% !important;
|
| 340 |
-
min-width: 0 !important;
|
| 341 |
-
visibility: visible !important;
|
| 342 |
-
opacity: 1 !important;
|
| 343 |
-
}
|
| 344 |
-
|
| 345 |
-
/* CHAT CONTAINER - MUCH LARGER */
|
| 346 |
-
.chat-main {
|
| 347 |
-
flex: 1 !important;
|
| 348 |
-
display: flex !important;
|
| 349 |
-
flex-direction: column !important;
|
| 350 |
-
height: 100% !important;
|
| 351 |
-
overflow: hidden !important;
|
| 352 |
-
visibility: visible !important;
|
| 353 |
-
opacity: 1 !important;
|
| 354 |
}
|
| 355 |
|
| 356 |
-
/*
|
| 357 |
-
.chat-messages {
|
| 358 |
flex: 1 !important;
|
| 359 |
overflow-y: auto !important;
|
| 360 |
padding: 1.5rem !important;
|
| 361 |
-
height:
|
| 362 |
-
min-height: 500px !important;
|
| 363 |
-
visibility: visible !important;
|
| 364 |
-
opacity: 1 !important;
|
| 365 |
-
}
|
| 366 |
-
|
| 367 |
-
/* LARGER CHATBOT - FORCE VISIBILITY */
|
| 368 |
-
.chatbot {
|
| 369 |
-
height: 600px !important;
|
| 370 |
-
min-height: 600px !important;
|
| 371 |
-
visibility: visible !important;
|
| 372 |
-
opacity: 1 !important;
|
| 373 |
-
display: block !important;
|
| 374 |
}
|
| 375 |
|
| 376 |
-
/*
|
| 377 |
-
.chat-input-
|
| 378 |
flex-shrink: 0 !important;
|
| 379 |
background: #1a1a1a !important;
|
| 380 |
border-top: 1px solid #262626 !important;
|
| 381 |
padding: 1.5rem !important;
|
| 382 |
-
max-height: none !important;
|
| 383 |
-
min-height: 200px !important;
|
| 384 |
-
visibility: visible !important;
|
| 385 |
-
opacity: 1 !important;
|
| 386 |
display: flex !important;
|
| 387 |
flex-direction: column !important;
|
| 388 |
gap: 1rem !important;
|
| 389 |
}
|
| 390 |
|
| 391 |
-
/*
|
| 392 |
-
.file-upload-area {
|
| 393 |
-
background: #1a1a1a !important;
|
| 394 |
-
border: 1px dashed #404040 !important;
|
| 395 |
-
border-radius: 8px !important;
|
| 396 |
-
padding: 1rem !important;
|
| 397 |
-
margin-bottom: 1rem !important;
|
| 398 |
-
transition: all 0.3s ease !important;
|
| 399 |
-
visibility: visible !important;
|
| 400 |
-
opacity: 1 !important;
|
| 401 |
-
display: block !important;
|
| 402 |
-
}
|
| 403 |
-
|
| 404 |
-
/* Input Styling - FORCE VISIBILITY */
|
| 405 |
-
.message-input {
|
| 406 |
-
background: #262626 !important;
|
| 407 |
-
border: 1px solid #404040 !important;
|
| 408 |
-
border-radius: 8px !important;
|
| 409 |
-
color: #ffffff !important;
|
| 410 |
-
padding: 1rem !important;
|
| 411 |
-
font-size: 0.95rem !important;
|
| 412 |
-
line-height: 1.4 !important;
|
| 413 |
-
resize: vertical !important;
|
| 414 |
-
transition: all 0.3s ease !important;
|
| 415 |
-
width: 100% !important;
|
| 416 |
-
margin-bottom: 1rem !important;
|
| 417 |
-
min-height: 80px !important;
|
| 418 |
-
visibility: visible !important;
|
| 419 |
-
opacity: 1 !important;
|
| 420 |
-
display: block !important;
|
| 421 |
-
}
|
| 422 |
-
|
| 423 |
-
/* Button Row - FORCE VISIBILITY */
|
| 424 |
-
.button-row {
|
| 425 |
-
display: flex !important;
|
| 426 |
-
gap: 1rem !important;
|
| 427 |
-
align-items: center !important;
|
| 428 |
-
justify-content: flex-end !important;
|
| 429 |
-
visibility: visible !important;
|
| 430 |
-
opacity: 1 !important;
|
| 431 |
-
}
|
| 432 |
-
|
| 433 |
-
/* Buttons - FORCE VISIBILITY */
|
| 434 |
-
.primary-button, .secondary-button {
|
| 435 |
-
visibility: visible !important;
|
| 436 |
-
opacity: 1 !important;
|
| 437 |
-
display: inline-block !important;
|
| 438 |
-
}
|
| 439 |
-
|
| 440 |
-
/* Override any Gradio hiding */
|
| 441 |
-
.gradio-container .block,
|
| 442 |
-
.gradio-container .form,
|
| 443 |
-
.gradio-container .wrap {
|
| 444 |
-
visibility: visible !important;
|
| 445 |
-
opacity: 1 !important;
|
| 446 |
-
display: block !important;
|
| 447 |
-
}
|
| 448 |
-
|
| 449 |
-
/* Force all gradio components to be visible */
|
| 450 |
-
.gr-form,
|
| 451 |
-
.gr-box,
|
| 452 |
-
.gr-panel {
|
| 453 |
-
visibility: visible !important;
|
| 454 |
-
opacity: 1 !important;
|
| 455 |
-
display: block !important;
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
/* Specific Gradio component fixes */
|
| 459 |
-
gradio-file,
|
| 460 |
-
gradio-textbox,
|
| 461 |
-
gradio-button,
|
| 462 |
-
gradio-chatbot {
|
| 463 |
-
visibility: visible !important;
|
| 464 |
-
opacity: 1 !important;
|
| 465 |
-
display: block !important;
|
| 466 |
-
}
|
| 467 |
-
|
| 468 |
-
/* Override Gradio's column behavior for exact alignment */
|
| 469 |
-
.desktop-layout > .block:first-child {
|
| 470 |
-
width: 350px !important;
|
| 471 |
-
min-width: 350px !important;
|
| 472 |
-
max-width: 350px !important;
|
| 473 |
-
flex: none !important;
|
| 474 |
-
height: 100% !important;
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
.desktop-layout > .block:last-child {
|
| 478 |
-
flex: 1 !important;
|
| 479 |
-
min-width: 0 !important;
|
| 480 |
-
height: 100% !important;
|
| 481 |
-
}
|
| 482 |
-
|
| 483 |
-
/* Quick Actions Section - MOVED TO TOP */
|
| 484 |
.quick-actions-section {
|
| 485 |
-
order: -1 !important;
|
| 486 |
margin-bottom: 2rem !important;
|
| 487 |
padding-bottom: 1.5rem !important;
|
| 488 |
border-bottom: 1px solid #dc2626 !important;
|
| 489 |
}
|
| 490 |
|
| 491 |
-
.sidebar-section {
|
| 492 |
-
margin-bottom: 1.5rem !important;
|
| 493 |
-
}
|
| 494 |
-
|
| 495 |
.sidebar-title {
|
| 496 |
color: #dc2626 !important;
|
| 497 |
font-weight: 700 !important;
|
|
@@ -504,6 +369,32 @@ gradio-chatbot {
|
|
| 504 |
gap: 0.5rem !important;
|
| 505 |
}
|
| 506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
.capabilities-list {
|
| 508 |
color: #d1d5db !important;
|
| 509 |
font-size: 0.85rem !important;
|
|
@@ -526,37 +417,46 @@ gradio-chatbot {
|
|
| 526 |
border-bottom: none !important;
|
| 527 |
}
|
| 528 |
|
| 529 |
-
/*
|
| 530 |
-
.
|
| 531 |
background: #1a1a1a !important;
|
| 532 |
-
color: #dc2626 !important;
|
| 533 |
border: 1px solid #dc2626 !important;
|
| 534 |
border-radius: 8px !important;
|
| 535 |
-
padding:
|
| 536 |
-
|
| 537 |
-
cursor: pointer !important;
|
| 538 |
-
transition: all 0.3s ease !important;
|
| 539 |
-
margin-bottom: 0.6rem !important;
|
| 540 |
-
width: 100% !important;
|
| 541 |
-
text-align: left !important;
|
| 542 |
-
font-size: 0.85rem !important;
|
| 543 |
-
display: flex !important;
|
| 544 |
-
align-items: center !important;
|
| 545 |
-
gap: 0.6rem !important;
|
| 546 |
}
|
| 547 |
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
|
|
|
|
|
|
|
|
|
| 553 |
}
|
| 554 |
|
| 555 |
-
.file-upload
|
| 556 |
border-color: #dc2626 !important;
|
| 557 |
background: #262626 !important;
|
| 558 |
}
|
| 559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
.message-input:focus {
|
| 561 |
outline: none !important;
|
| 562 |
border-color: #dc2626 !important;
|
|
@@ -567,7 +467,14 @@ gradio-chatbot {
|
|
| 567 |
color: #6b7280 !important;
|
| 568 |
}
|
| 569 |
|
| 570 |
-
/* Buttons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
.primary-button {
|
| 572 |
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
|
| 573 |
color: white !important;
|
|
@@ -610,16 +517,15 @@ gradio-chatbot {
|
|
| 610 |
border-color: #dc2626 !important;
|
| 611 |
}
|
| 612 |
|
| 613 |
-
/*
|
| 614 |
-
.
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
border
|
| 618 |
-
|
| 619 |
-
margin-bottom: 1rem !important;
|
| 620 |
}
|
| 621 |
|
| 622 |
-
/* Scrollbar
|
| 623 |
::-webkit-scrollbar {
|
| 624 |
width: 6px !important;
|
| 625 |
height: 6px !important;
|
|
@@ -639,29 +545,21 @@ gradio-chatbot {
|
|
| 639 |
background: #dc2626 !important;
|
| 640 |
}
|
| 641 |
|
| 642 |
-
/*
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
flex: 1 !important;
|
| 658 |
-
height: 100% !important;
|
| 659 |
-
}
|
| 660 |
-
|
| 661 |
-
.chatbot {
|
| 662 |
-
height: 600px !important;
|
| 663 |
-
min-height: 600px !important;
|
| 664 |
-
}
|
| 665 |
}
|
| 666 |
|
| 667 |
/* Footer */
|
|
@@ -680,36 +578,15 @@ gradio-chatbot {
|
|
| 680 |
color: #dc2626 !important;
|
| 681 |
}
|
| 682 |
|
| 683 |
-
/*
|
| 684 |
-
.gradio-container
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
.gradio-container .contain {
|
| 689 |
-
padding: 0 !important;
|
| 690 |
-
}
|
| 691 |
-
|
| 692 |
-
/* Ensure proper text display in chat */
|
| 693 |
-
.message {
|
| 694 |
-
font-size: 0.9rem !important;
|
| 695 |
-
line-height: 1.6 !important;
|
| 696 |
-
}
|
| 697 |
-
|
| 698 |
-
/* Code blocks in chat should be readable */
|
| 699 |
-
pre {
|
| 700 |
-
background: #1a1a1a !important;
|
| 701 |
-
border: 1px solid #404040 !important;
|
| 702 |
-
border-radius: 6px !important;
|
| 703 |
-
padding: 1rem !important;
|
| 704 |
-
overflow-x: auto !important;
|
| 705 |
-
font-size: 0.85rem !important;
|
| 706 |
}
|
| 707 |
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
border-radius: 3px !important;
|
| 712 |
-
font-size: 0.85rem !important;
|
| 713 |
}
|
| 714 |
"""
|
| 715 |
|
|
@@ -747,7 +624,7 @@ def quick_action(action_text):
|
|
| 747 |
"""Handle quick action buttons."""
|
| 748 |
return action_text
|
| 749 |
|
| 750 |
-
# Create the main interface with FIXED
|
| 751 |
with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.themes.Base()) as app:
|
| 752 |
|
| 753 |
# Header
|
|
@@ -758,15 +635,15 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
|
|
| 758 |
</div>
|
| 759 |
""")
|
| 760 |
|
| 761 |
-
#
|
| 762 |
-
with gr.Row(elem_classes=["
|
| 763 |
|
| 764 |
-
# Left Sidebar - FIXED
|
| 765 |
-
with gr.Column(elem_classes=["
|
| 766 |
|
| 767 |
-
#
|
| 768 |
with gr.Column(elem_classes=["quick-actions-section"]):
|
| 769 |
-
gr.HTML('<h3 class="sidebar-title"><span
|
| 770 |
|
| 771 |
quick_generate = gr.Button("π₯ Generate Code", elem_classes=["quick-action-button"])
|
| 772 |
quick_review = gr.Button("π Code Review", elem_classes=["quick-action-button"])
|
|
@@ -775,9 +652,9 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
|
|
| 775 |
quick_explain = gr.Button("π Explain Code", elem_classes=["quick-action-button"])
|
| 776 |
quick_test = gr.Button("π§ͺ Create Tests", elem_classes=["quick-action-button"])
|
| 777 |
|
| 778 |
-
# Capabilities Section
|
| 779 |
-
with gr.Column(
|
| 780 |
-
gr.HTML('<h3 class="sidebar-title"><span
|
| 781 |
|
| 782 |
gr.HTML("""
|
| 783 |
<div class="capabilities-list">
|
|
@@ -800,66 +677,60 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
|
|
| 800 |
</div>
|
| 801 |
""")
|
| 802 |
|
| 803 |
-
# Right Chat Container -
|
| 804 |
-
with gr.Column(elem_classes=["
|
| 805 |
|
| 806 |
-
|
| 807 |
-
|
| 808 |
chatbot = gr.Chatbot(
|
| 809 |
-
height=
|
| 810 |
show_label=False,
|
| 811 |
container=True,
|
| 812 |
-
type='messages',
|
| 813 |
avatar_images=("π¨βπ»", "π€"),
|
| 814 |
-
elem_classes=["
|
| 815 |
-
visible=True
|
| 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 |
-
placeholder="Describe what you want to build, analyze, or improve... Type 'continue' to extend previous code.",
|
| 842 |
-
show_label=False,
|
| 843 |
-
lines=3,
|
| 844 |
-
max_lines=6,
|
| 845 |
-
elem_classes=["message-input"],
|
| 846 |
-
visible=True
|
| 847 |
)
|
| 848 |
-
|
| 849 |
-
# Button row - better spaced
|
| 850 |
-
with gr.Row(elem_classes=["button-row"], visible=True):
|
| 851 |
-
clear = gr.Button(
|
| 852 |
-
"CLEAR",
|
| 853 |
-
variant="secondary",
|
| 854 |
-
elem_classes=["secondary-button"],
|
| 855 |
-
visible=True
|
| 856 |
-
)
|
| 857 |
-
submit = gr.Button(
|
| 858 |
-
"SEND",
|
| 859 |
-
variant="primary",
|
| 860 |
-
elem_classes=["primary-button"],
|
| 861 |
-
visible=True
|
| 862 |
-
)
|
| 863 |
|
| 864 |
# Hidden state
|
| 865 |
chat_history = gr.State([])
|
|
@@ -869,7 +740,12 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
|
|
| 869 |
result = process_chat_message(message, files, history)
|
| 870 |
return result
|
| 871 |
|
| 872 |
-
# Quick actions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 873 |
quick_review.click(
|
| 874 |
lambda: "Please perform a comprehensive code review of the uploaded files. Analyze code quality, identify potential bugs, suggest performance improvements, check for security vulnerabilities, and provide detailed recommendations with examples.",
|
| 875 |
outputs=msg
|
|
@@ -890,17 +766,12 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
|
|
| 890 |
outputs=msg
|
| 891 |
)
|
| 892 |
|
| 893 |
-
quick_generate.click(
|
| 894 |
-
lambda: "Please generate a complete, production-ready application based on the requirements. Include all necessary components, error handling, documentation, and best practices.",
|
| 895 |
-
outputs=msg
|
| 896 |
-
)
|
| 897 |
-
|
| 898 |
quick_test.click(
|
| 899 |
lambda: "Please create comprehensive unit tests for the uploaded code. Include test cases for all functions, edge cases, error handling, and integration tests where applicable.",
|
| 900 |
outputs=msg
|
| 901 |
)
|
| 902 |
|
| 903 |
-
# Main functionality
|
| 904 |
submit.click(
|
| 905 |
handle_submit,
|
| 906 |
inputs=[msg, files, chat_history],
|
|
|
|
| 251 |
# Initialize the copilot
|
| 252 |
copilot = CodingCopilot()
|
| 253 |
|
| 254 |
+
# FIXED CSS - Proper targeting and visibility
|
| 255 |
desktop_css = """
|
| 256 |
+
/* Base container */
|
| 257 |
.gradio-container {
|
| 258 |
max-width: none !important;
|
| 259 |
width: 100vw !important;
|
|
|
|
| 263 |
color: #ffffff !important;
|
| 264 |
padding: 1rem !important;
|
| 265 |
box-sizing: border-box !important;
|
|
|
|
| 266 |
}
|
| 267 |
|
| 268 |
+
/* Header */
|
| 269 |
.header-container {
|
| 270 |
background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 50%, #1a1a1a 100%) !important;
|
| 271 |
border: 1px solid #dc2626 !important;
|
|
|
|
| 294 |
font-weight: 400 !important;
|
| 295 |
}
|
| 296 |
|
| 297 |
+
/* Main layout container */
|
| 298 |
+
.main-content {
|
| 299 |
display: flex !important;
|
| 300 |
flex-direction: row !important;
|
| 301 |
gap: 1.5rem !important;
|
| 302 |
height: calc(100vh - 200px) !important;
|
|
|
|
|
|
|
| 303 |
min-height: 700px !important;
|
| 304 |
}
|
| 305 |
|
| 306 |
+
/* Sidebar */
|
| 307 |
+
.sidebar-container {
|
| 308 |
background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%) !important;
|
| 309 |
border: 1px solid #dc2626 !important;
|
| 310 |
border-radius: 16px !important;
|
|
|
|
| 313 |
min-width: 350px !important;
|
| 314 |
max-width: 350px !important;
|
| 315 |
flex-shrink: 0 !important;
|
|
|
|
| 316 |
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.1) !important;
|
| 317 |
overflow-y: auto !important;
|
| 318 |
height: 100% !important;
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
| 321 |
+
/* Chat container */
|
| 322 |
+
.chat-container {
|
| 323 |
background: linear-gradient(180deg, #111111 0%, #0a0a0a 100%) !important;
|
| 324 |
border: 1px solid #262626 !important;
|
| 325 |
border-radius: 16px !important;
|
| 326 |
flex: 1 !important;
|
|
|
|
|
|
|
| 327 |
display: flex !important;
|
| 328 |
flex-direction: column !important;
|
| 329 |
overflow: hidden !important;
|
| 330 |
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
| 331 |
height: 100% !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
}
|
| 333 |
|
| 334 |
+
/* Chat messages area */
|
| 335 |
+
.chat-messages-area {
|
| 336 |
flex: 1 !important;
|
| 337 |
overflow-y: auto !important;
|
| 338 |
padding: 1.5rem !important;
|
| 339 |
+
min-height: 400px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
}
|
| 341 |
|
| 342 |
+
/* Chat input area */
|
| 343 |
+
.chat-input-container {
|
| 344 |
flex-shrink: 0 !important;
|
| 345 |
background: #1a1a1a !important;
|
| 346 |
border-top: 1px solid #262626 !important;
|
| 347 |
padding: 1.5rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
display: flex !important;
|
| 349 |
flex-direction: column !important;
|
| 350 |
gap: 1rem !important;
|
| 351 |
}
|
| 352 |
|
| 353 |
+
/* Quick Actions */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
.quick-actions-section {
|
|
|
|
| 355 |
margin-bottom: 2rem !important;
|
| 356 |
padding-bottom: 1.5rem !important;
|
| 357 |
border-bottom: 1px solid #dc2626 !important;
|
| 358 |
}
|
| 359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
.sidebar-title {
|
| 361 |
color: #dc2626 !important;
|
| 362 |
font-weight: 700 !important;
|
|
|
|
| 369 |
gap: 0.5rem !important;
|
| 370 |
}
|
| 371 |
|
| 372 |
+
.quick-action-button {
|
| 373 |
+
background: #1a1a1a !important;
|
| 374 |
+
color: #dc2626 !important;
|
| 375 |
+
border: 1px solid #dc2626 !important;
|
| 376 |
+
border-radius: 8px !important;
|
| 377 |
+
padding: 0.8rem 1rem !important;
|
| 378 |
+
font-weight: 500 !important;
|
| 379 |
+
cursor: pointer !important;
|
| 380 |
+
transition: all 0.3s ease !important;
|
| 381 |
+
margin-bottom: 0.6rem !important;
|
| 382 |
+
width: 100% !important;
|
| 383 |
+
text-align: left !important;
|
| 384 |
+
font-size: 0.85rem !important;
|
| 385 |
+
display: flex !important;
|
| 386 |
+
align-items: center !important;
|
| 387 |
+
gap: 0.6rem !important;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
.quick-action-button:hover {
|
| 391 |
+
background: #dc2626 !important;
|
| 392 |
+
color: #ffffff !important;
|
| 393 |
+
transform: translateX(3px) !important;
|
| 394 |
+
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2) !important;
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
/* Capabilities section */
|
| 398 |
.capabilities-list {
|
| 399 |
color: #d1d5db !important;
|
| 400 |
font-size: 0.85rem !important;
|
|
|
|
| 417 |
border-bottom: none !important;
|
| 418 |
}
|
| 419 |
|
| 420 |
+
/* Download section */
|
| 421 |
+
.download-section {
|
| 422 |
background: #1a1a1a !important;
|
|
|
|
| 423 |
border: 1px solid #dc2626 !important;
|
| 424 |
border-radius: 8px !important;
|
| 425 |
+
padding: 1rem !important;
|
| 426 |
+
margin-bottom: 1rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
}
|
| 428 |
|
| 429 |
+
/* File upload */
|
| 430 |
+
.file-upload {
|
| 431 |
+
background: #1a1a1a !important;
|
| 432 |
+
border: 1px dashed #404040 !important;
|
| 433 |
+
border-radius: 8px !important;
|
| 434 |
+
padding: 1rem !important;
|
| 435 |
+
margin-bottom: 1rem !important;
|
| 436 |
+
transition: all 0.3s ease !important;
|
| 437 |
}
|
| 438 |
|
| 439 |
+
.file-upload:hover {
|
| 440 |
border-color: #dc2626 !important;
|
| 441 |
background: #262626 !important;
|
| 442 |
}
|
| 443 |
|
| 444 |
+
/* Message input */
|
| 445 |
+
.message-input {
|
| 446 |
+
background: #262626 !important;
|
| 447 |
+
border: 1px solid #404040 !important;
|
| 448 |
+
border-radius: 8px !important;
|
| 449 |
+
color: #ffffff !important;
|
| 450 |
+
padding: 1rem !important;
|
| 451 |
+
font-size: 0.95rem !important;
|
| 452 |
+
line-height: 1.4 !important;
|
| 453 |
+
resize: vertical !important;
|
| 454 |
+
transition: all 0.3s ease !important;
|
| 455 |
+
width: 100% !important;
|
| 456 |
+
margin-bottom: 1rem !important;
|
| 457 |
+
min-height: 80px !important;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
.message-input:focus {
|
| 461 |
outline: none !important;
|
| 462 |
border-color: #dc2626 !important;
|
|
|
|
| 467 |
color: #6b7280 !important;
|
| 468 |
}
|
| 469 |
|
| 470 |
+
/* Buttons */
|
| 471 |
+
.button-row {
|
| 472 |
+
display: flex !important;
|
| 473 |
+
gap: 1rem !important;
|
| 474 |
+
align-items: center !important;
|
| 475 |
+
justify-content: flex-end !important;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
.primary-button {
|
| 479 |
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
|
| 480 |
color: white !important;
|
|
|
|
| 517 |
border-color: #dc2626 !important;
|
| 518 |
}
|
| 519 |
|
| 520 |
+
/* Chatbot specific */
|
| 521 |
+
.chatbot {
|
| 522 |
+
height: 100% !important;
|
| 523 |
+
min-height: 400px !important;
|
| 524 |
+
border: none !important;
|
| 525 |
+
background: transparent !important;
|
|
|
|
| 526 |
}
|
| 527 |
|
| 528 |
+
/* Scrollbar */
|
| 529 |
::-webkit-scrollbar {
|
| 530 |
width: 6px !important;
|
| 531 |
height: 6px !important;
|
|
|
|
| 545 |
background: #dc2626 !important;
|
| 546 |
}
|
| 547 |
|
| 548 |
+
/* Code blocks */
|
| 549 |
+
pre {
|
| 550 |
+
background: #1a1a1a !important;
|
| 551 |
+
border: 1px solid #404040 !important;
|
| 552 |
+
border-radius: 6px !important;
|
| 553 |
+
padding: 1rem !important;
|
| 554 |
+
overflow-x: auto !important;
|
| 555 |
+
font-size: 0.85rem !important;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
code {
|
| 559 |
+
background: #262626 !important;
|
| 560 |
+
padding: 2px 4px !important;
|
| 561 |
+
border-radius: 3px !important;
|
| 562 |
+
font-size: 0.85rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
}
|
| 564 |
|
| 565 |
/* Footer */
|
|
|
|
| 578 |
color: #dc2626 !important;
|
| 579 |
}
|
| 580 |
|
| 581 |
+
/* Force visibility of all components */
|
| 582 |
+
.gradio-container * {
|
| 583 |
+
visibility: visible !important;
|
| 584 |
+
opacity: 1 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
}
|
| 586 |
|
| 587 |
+
/* Ensure proper display */
|
| 588 |
+
.block, .form, .wrap {
|
| 589 |
+
display: block !important;
|
|
|
|
|
|
|
| 590 |
}
|
| 591 |
"""
|
| 592 |
|
|
|
|
| 624 |
"""Handle quick action buttons."""
|
| 625 |
return action_text
|
| 626 |
|
| 627 |
+
# Create the main interface with COMPLETELY FIXED layout
|
| 628 |
with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.themes.Base()) as app:
|
| 629 |
|
| 630 |
# Header
|
|
|
|
| 635 |
</div>
|
| 636 |
""")
|
| 637 |
|
| 638 |
+
# Main content container - FIXED STRUCTURE
|
| 639 |
+
with gr.Row(elem_classes=["main-content"]):
|
| 640 |
|
| 641 |
+
# Left Sidebar - FIXED
|
| 642 |
+
with gr.Column(elem_classes=["sidebar-container"], scale=0, min_width=350):
|
| 643 |
|
| 644 |
+
# Quick Actions Section
|
| 645 |
with gr.Column(elem_classes=["quick-actions-section"]):
|
| 646 |
+
gr.HTML('<h3 class="sidebar-title"><span>β‘</span>QUICK ACTIONS</h3>')
|
| 647 |
|
| 648 |
quick_generate = gr.Button("π₯ Generate Code", elem_classes=["quick-action-button"])
|
| 649 |
quick_review = gr.Button("π Code Review", elem_classes=["quick-action-button"])
|
|
|
|
| 652 |
quick_explain = gr.Button("π Explain Code", elem_classes=["quick-action-button"])
|
| 653 |
quick_test = gr.Button("π§ͺ Create Tests", elem_classes=["quick-action-button"])
|
| 654 |
|
| 655 |
+
# Capabilities Section
|
| 656 |
+
with gr.Column():
|
| 657 |
+
gr.HTML('<h3 class="sidebar-title"><span>π―</span>CAPABILITIES</h3>')
|
| 658 |
|
| 659 |
gr.HTML("""
|
| 660 |
<div class="capabilities-list">
|
|
|
|
| 677 |
</div>
|
| 678 |
""")
|
| 679 |
|
| 680 |
+
# Right Chat Container - COMPLETELY FIXED
|
| 681 |
+
with gr.Column(elem_classes=["chat-container"], scale=1):
|
| 682 |
|
| 683 |
+
# Chat Messages Area - FIXED
|
| 684 |
+
with gr.Column(elem_classes=["chat-messages-area"]):
|
| 685 |
chatbot = gr.Chatbot(
|
| 686 |
+
height=500,
|
| 687 |
show_label=False,
|
| 688 |
container=True,
|
|
|
|
| 689 |
avatar_images=("π¨βπ»", "π€"),
|
| 690 |
+
elem_classes=["chatbot"]
|
|
|
|
| 691 |
)
|
| 692 |
+
|
| 693 |
+
# Chat Input Container - FIXED AND VISIBLE
|
| 694 |
+
with gr.Column(elem_classes=["chat-input-container"]):
|
| 695 |
|
| 696 |
+
# Download section
|
| 697 |
+
download_status = gr.HTML("")
|
| 698 |
+
download_file = gr.File(
|
| 699 |
+
label="π₯ Download Generated Code",
|
| 700 |
+
visible=False,
|
| 701 |
+
elem_classes=["download-section"]
|
| 702 |
+
)
|
| 703 |
+
|
| 704 |
+
# File upload
|
| 705 |
+
files = gr.File(
|
| 706 |
+
label="π Upload Code Files (.py, .ipynb)",
|
| 707 |
+
file_count="multiple",
|
| 708 |
+
file_types=[".py", ".ipynb"],
|
| 709 |
+
elem_classes=["file-upload"]
|
| 710 |
+
)
|
| 711 |
+
|
| 712 |
+
# Message input
|
| 713 |
+
msg = gr.Textbox(
|
| 714 |
+
label="",
|
| 715 |
+
placeholder="Describe what you want to build, analyze, or improve... Type 'continue' to extend previous code.",
|
| 716 |
+
show_label=False,
|
| 717 |
+
lines=3,
|
| 718 |
+
max_lines=6,
|
| 719 |
+
elem_classes=["message-input"]
|
| 720 |
+
)
|
| 721 |
+
|
| 722 |
+
# Button row
|
| 723 |
+
with gr.Row(elem_classes=["button-row"]):
|
| 724 |
+
clear = gr.Button(
|
| 725 |
+
"CLEAR",
|
| 726 |
+
variant="secondary",
|
| 727 |
+
elem_classes=["secondary-button"]
|
| 728 |
)
|
| 729 |
+
submit = gr.Button(
|
| 730 |
+
"SEND",
|
| 731 |
+
variant="primary",
|
| 732 |
+
elem_classes=["primary-button"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 734 |
|
| 735 |
# Hidden state
|
| 736 |
chat_history = gr.State([])
|
|
|
|
| 740 |
result = process_chat_message(message, files, history)
|
| 741 |
return result
|
| 742 |
|
| 743 |
+
# Quick actions - ALL WORKING
|
| 744 |
+
quick_generate.click(
|
| 745 |
+
lambda: "Please generate a complete, production-ready application based on the requirements. Include all necessary components, error handling, documentation, and best practices.",
|
| 746 |
+
outputs=msg
|
| 747 |
+
)
|
| 748 |
+
|
| 749 |
quick_review.click(
|
| 750 |
lambda: "Please perform a comprehensive code review of the uploaded files. Analyze code quality, identify potential bugs, suggest performance improvements, check for security vulnerabilities, and provide detailed recommendations with examples.",
|
| 751 |
outputs=msg
|
|
|
|
| 766 |
outputs=msg
|
| 767 |
)
|
| 768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 769 |
quick_test.click(
|
| 770 |
lambda: "Please create comprehensive unit tests for the uploaded code. Include test cases for all functions, edge cases, error handling, and integration tests where applicable.",
|
| 771 |
outputs=msg
|
| 772 |
)
|
| 773 |
|
| 774 |
+
# Main chat functionality - ALL WORKING
|
| 775 |
submit.click(
|
| 776 |
handle_submit,
|
| 777 |
inputs=[msg, files, chat_history],
|