Skip to content
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

update web_selenium.py to use try-with for headers #2988

Merged
merged 5 commits into from
May 1, 2023

Conversation

non-adj
Copy link
Contributor

@non-adj non-adj commented Apr 23, 2023

This modification uses a with statement to open and read the file, which automatically closes the file after the block is executed. It also adds a try-except block to catch any errors when executing the script.

Background

I am running MacOS and switched between Local and WeaviateMemory to understand the pros and cons of vector-based storage. During this, Weaviate stopped working and would return errors related to a wrong name for calling Auto-Gpt.JSON. The error was related to how Weaviate must receive file names

raise UnexpectedStatusCodeException("Create class", response) weaviate.exceptions.UnexpectedStatusCodeException: Create class! Unexpected status code: 422, with response body: {'error': [{'message': "'Auto-gpt' is not a valid class name"}]}.

Changes

I had a conversation with Auto-GPT about the issue and was walked through finding the offending file, and applying the correct changes

Documentation

GPT: it seems like there's an issue in the add_header function when it executes the overlay.js script.

To fix this issue, let's modify the add_header function in web_selenium.py

Test Plan

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

This modification uses a with statement to open and read the file, which automatically closes the file after the block is executed. It also adds a try-except block to catch any errors when executing the script.
@Wladastic
Copy link
Contributor

Please run "black ." and commit again

@k-boikov k-boikov added needs restructuring PRs that should be split or restructured one-liner labels Apr 23, 2023
@non-adj
Copy link
Contributor Author

non-adj commented Apr 23, 2023

Running the "black ." in the commands folder, to format the web_selenium.py file, did nothing successfully:

"All done! ✨ 🍰 ✨
15 files left unchanged."

GPT-4 says:

"In this specific case, the original code snippet is already formatted according to the "black" style guide, so there are no changes."

Otherwise, this commit allows for the use of Weaviate properly and should be submitted 👍

@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Patch coverage has no change and project coverage change: -8.57 ⚠️

Comparison is base (aedd288) 49.20% compared to head (3fcdb79) 40.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2988      +/-   ##
==========================================
- Coverage   49.20%   40.64%   -8.57%     
==========================================
  Files          63       63              
  Lines        3014     3019       +5     
  Branches      496      497       +1     
==========================================
- Hits         1483     1227     -256     
- Misses       1411     1720     +309     
+ Partials      120       72      -48     
Impacted Files Coverage Δ
autogpt/commands/web_selenium.py 0.00% <0.00%> (ø)

... and 15 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Vwing
Copy link
Contributor

Vwing commented May 1, 2023

Running the "black ." in the commands folder, to format the web_selenium.py file, did nothing successfully:

"All done! ✨ 🍰 ✨ 15 files left unchanged."

GPT-4 says:

"In this specific case, the original code snippet is already formatted according to the "black" style guide, so there are no changes."

Otherwise, this commit allows for the use of Weaviate properly and should be submitted 👍

The issue is that there's an extra trailing newline at the end of the file. black . should work to fix that, but if not you can try removing the extra newline manually and see if the linter agrees with you.

Just to be extra clear: there should be only one trailing newline, and your problem is that you have two.

@vercel
Copy link

vercel bot commented May 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview May 1, 2023 3:41pm

@github-actions github-actions bot added size/s and removed size/xs labels May 1, 2023
@vercel vercel bot temporarily deployed to Preview May 1, 2023 14:36 Inactive
@codecov
Copy link

codecov bot commented May 1, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.01 ⚠️

Comparison is base (94ec4a4) 60.26% compared to head (a4cf3ce) 60.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2988      +/-   ##
==========================================
- Coverage   60.26%   60.26%   -0.01%     
==========================================
  Files          69       69              
  Lines        3143     3148       +5     
  Branches      525      526       +1     
==========================================
+ Hits         1894     1897       +3     
- Misses       1116     1118       +2     
  Partials      133      133              
Impacted Files Coverage Δ
autogpt/commands/web_selenium.py 86.04% <66.66%> (-1.61%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@richbeales richbeales merged commit 7fc6f2a into Significant-Gravitas:master May 1, 2023
@non-adj non-adj deleted the patch-2 branch May 2, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs restructuring PRs that should be split or restructured one-liner size/s
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants