prernajeet14 commited on
Commit
17acf06
·
verified ·
1 Parent(s): bcddf76

Update appp.py

Browse files
Files changed (1) hide show
  1. appp.py +68 -5
appp.py CHANGED
@@ -787,17 +787,80 @@ with gr.Blocks(css=desktop_css, title="Coding Copilot Pro - Desktop", theme=gr.t
787
 
788
  # Hidden state
789
  chat_history = gr.State([])
790
-
791
  # Event handlers
792
  def handle_submit(message, files, history):
793
  result = process_chat_message(message, files, history)
794
  return result
795
 
796
- # Quick actions with better prompts
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  quick_generate.click(
798
- lambda: "Please generate a complete, production-ready application based on the requirements. Include all necessary components, error handling, documentation, and best practices. Provide comprehensive code with full functionality.",
799
  outputs=msg
800
  )
801
 
802
- quick_review.click(
803
- lambda: "Please perform a comprehensive code review of the uploaded files. Analyze code quality, identify potential bugs, suggest performance improvements,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787
 
788
  # Hidden state
789
  chat_history = gr.State([])
790
+
791
  # Event handlers
792
  def handle_submit(message, files, history):
793
  result = process_chat_message(message, files, history)
794
  return result
795
 
796
+ # Quick actions
797
+ quick_review.click(
798
+ 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.",
799
+ outputs=msg
800
+ )
801
+
802
+ quick_debug.click(
803
+ lambda: "Please debug the uploaded code thoroughly. Identify any errors, bugs, logical issues, or potential runtime problems. Provide detailed explanations and complete fixed versions of the code.",
804
+ outputs=msg
805
+ )
806
+
807
+ quick_optimize.click(
808
+ lambda: "Please optimize the uploaded code for better performance, memory usage, and readability. Provide the complete optimized version with explanations of the improvements made.",
809
+ outputs=msg
810
+ )
811
+
812
+ quick_explain.click(
813
+ lambda: "Please provide a detailed explanation of the uploaded code. Break down its functionality, explain the algorithms used, document all functions and classes, and create comprehensive documentation.",
814
+ outputs=msg
815
+ )
816
+
817
  quick_generate.click(
818
+ lambda: "Please generate a complete, production-ready application based on the requirements. Include all necessary components, error handling, documentation, and best practices.",
819
  outputs=msg
820
  )
821
 
822
+ quick_test.click(
823
+ 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.",
824
+ outputs=msg
825
+ )
826
+
827
+ # Main functionality
828
+ submit.click(
829
+ handle_submit,
830
+ inputs=[msg, files, chat_history],
831
+ outputs=[chatbot, chat_history, msg, download_file, download_status]
832
+ ).then(
833
+ lambda: None,
834
+ outputs=files
835
+ )
836
+
837
+ msg.submit(
838
+ handle_submit,
839
+ inputs=[msg, files, chat_history],
840
+ outputs=[chatbot, chat_history, msg, download_file, download_status]
841
+ ).then(
842
+ lambda: None,
843
+ outputs=files
844
+ )
845
+
846
+ clear.click(
847
+ clear_chat,
848
+ outputs=[chatbot, chat_history, download_file, download_status]
849
+ )
850
+
851
+ # Footer
852
+ gr.HTML("""
853
+ <div class="footer">
854
+ <p><strong>🚀 CODING COPILOT PRO</strong> • Professional Development Assistant</p>
855
+ <p>Upload your code files and start building • Advanced AI • Secure & Private</p>
856
+ </div>
857
+ """)
858
+
859
+ # Launch the app
860
+ if __name__ == "__main__":
861
+ app.launch(
862
+ server_name="0.0.0.0",
863
+ server_port=7860,
864
+ share=True,
865
+ show_error=True
866
+ )