Spaces:
Sleeping
Sleeping
Better error handling + recommended repos list
Browse files185 unmodified lines18618718818919019169 unmodified lines261262263264265266267185 unmodified lines# Tab 1: Setupwith gr.Tab("βοΈ Setup", id=1):gr.Markdown("# βοΈ Setup Challenge")url_input = gr.Textbox(label="GitHub URL", value="https://github.com/mahmoud/boltons")with gr.Row():num_bugs = gr.Slider(1, 5, value=3, step=1, label="Number of Bugs")69 unmodified linesyield gr.Tabs(selected=2), f"β Ready! File: {cs.target_file}", readme, code, workspaceexcept Exception as exc:logger.error(f"Pipeline failed: {exc}", exc_info=True)yield gr.Tabs(selected=1), f"β Error: {exc}", "", "", ""def on_submit(workspace, code, hints_used, submit_count):logger.info(f"Submit clicked (hints={hints_used}, attempt={submit_count+1})")185 unmodified lines18618718818919019119219319419519619769 unmodified lines267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300185 unmodified lines# Tab 1: Setupwith gr.Tab("βοΈ Setup", id=1):gr.Markdown("# βοΈ Setup Challenge")gr.Markdown("""**Recommended repositories:**- `https://github.com/mahmoud/boltons` (utilities library - works great!)- `https://github.com/psf/requests` (HTTP library)- `https://github.com/pallets/flask` (web framework)""")url_input = gr.Textbox(label="GitHub URL", value="https://github.com/mahmoud/boltons")with gr.Row():num_bugs = gr.Slider(1, 5, value=3, step=1, label="Number of Bugs")69 unmodified linesyield gr.Tabs(selected=2), f"β Ready! File: {cs.target_file}", readme, code, workspaceexcept Exception as exc:logger.error(f"Pipeline failed: {exc}", exc_info=True)error_msg = str(exc)# Provide helpful error messagesif "not found in source" in error_msg:error_msg = f"""β **Function not found in repository**The system couldn't find a suitable function to create a challenge.**Possible solutions:**1. Try a different repository (one with Python code)2. Lower the **Nesting Level** slider (try 1 or 2)3. Use a well-known repo like: `https://github.com/mahmoud/boltons`**Technical details:** {exc}"""elif "git" in error_msg.lower() or "clone" in error_msg.lower():error_msg = f"""β **Repository access failed**Could not clone the repository.**Check:**- URL is correct and public- Repository contains Python code**Error:** {exc}"""else:error_msg = f"β **Error creating challenge:**\n\n{exc}"yield gr.Tabs(selected=1), error_msg, "", "", ""def on_submit(workspace, code, hints_used, submit_count):logger.info(f"Submit clicked (hints={hints_used}, attempt={submit_count+1})")
minimal_test.py+34-1