You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add 'global variable_name' at the start of the function that's trying to modify a global variable."""
175
-
eliferror_type=="NameError":
176
-
error_guidance="""NameError. To fix:
177
-
Either define the missing variable or fix the typo in the variable name."""
178
-
eliferror_type=="AttributeError":
179
-
error_guidance="""AttributeError. To fix:
180
-
Use the correct method/attribute name or check the object type."""
181
-
eliferror_type=="TypeError":
182
-
error_guidance="""TypeError. To fix:
183
-
Fix the function arguments or type mismatch."""
184
-
eliferror_type=="IndexError":
185
-
error_guidance="""IndexError. To fix:
186
-
Check list/array bounds before accessing."""
187
-
188
-
system_prompt="""You are a Python expert debugging a pygame script that has an error.
189
-
190
-
Output format:
191
-
1. One sentence explaining the fix.
192
-
2. Incorporate the fix into a code snippet in the style of a before/after git diff.
193
-
a. Show the fix and a couple surrounding lines of code.
194
-
b. ONLY 5-10 lines of code.
195
-
3. Complete CORRECTED code wrapped in a markdown code block using triple backticks (```python).
196
-
197
-
IMPORTANT:
198
-
- The final code you output must have the fix applied.
199
-
- Be CAREFUL not to get carried away repeating the old code.
200
-
"""
201
-
202
-
user_prompt=f"""The code below has this error:
203
-
{mode_data}
204
159
205
-
Here is some guidance on the error:
160
+
system_prompt="You are a Python expert debugging a pygame script that has an error. Generate ONLY the fixed Python code wrapped in a markdown code block using triple backticks (```python). Do not include any explanations outside the code block."
206
161
207
-
{error_guidance}
208
-
209
-
Look at the code below and give me a complete pygame script where the error is fixed:
162
+
user_prompt=f"""Error:
163
+
{mode_data}
210
164
165
+
Script with error:
211
166
```python
212
167
{content}
213
168
```
169
+
170
+
Please fix the bug and provide the corrected code.
0 commit comments