-
Notifications
You must be signed in to change notification settings - Fork 44.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed revising constraints and best practices #6777
Fixed revising constraints and best practices #6777
Conversation
✅ Deploy Preview for auto-gpt-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
You're right about the bug, a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix could be a bit simpler though, by turning the for
loop into a while
loop, like this:
# Revise constraints
- for i, constraint in enumerate(directives.constraints):
+ i = 0
+ while i < len(directives.constraints)
+ constraint = directives.constraints[i]
print_attribute(f"Constraint {i+1}:", f'"{constraint}"')
new_constraint = (
await clean_input(
app_config,
f"Enter new constraint {i+1}"
" (press enter to keep current, or '-' to remove):",
)
or constraint
)
if new_constraint == "-":
directives.constraints.remove(constraint)
+ continue
elif new_constraint:
directives.constraints[i] = new_constraint
+ i += 1
…for iterating over constraints, resources, and best practices
Made the requested changes |
Please run |
I have ran the commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what happened, but it looks like the linter ran with the wrong settings (probably because of wrong CWD). Diff now contains a lot of code formatting changes that are outside the scope of the PR.
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
You can probably revert this commit and try again 2bd8a50 |
2bd8a50
to
784e2bb
Compare
Rebased it |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
Thank you very much :) |
Background
When using AutoGPT I noticed that it starts to skip constraints and best practices when you use "-" to remove them, it seems like that happens because the constraints are removed in the for loop immediately thus shortening the list and skipping over other constraints.
Changes 🏗️
I have made an list for constraints and best practices each, the ones designated for removal are added to that list and removed after the for loop has finished
PR Quality Scorecard ✨
+2 pts
+5 pts
+5 pts
+5 pts
-4 pts
+4 pts
+5 pts
-5 pts
agbenchmark
to verify that these changes do not regress performance?+10 pts