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

Add makedirs to file operations #3289

Merged
merged 11 commits into from
Apr 27, 2023

Conversation

montanaflynn
Copy link
Contributor

@montanaflynn montanaflynn commented Apr 26, 2023

Background

Many times auto gpt will try to download or append to files in a directory that doesn't exist, this will cause an error that it then tries to correct, sometimes unsuccessfully.

Related issue: #3249

Changes

I added logic to check if the directory exists and if not create it. I used the same code already being used for write_to_file and added it to the append_to_file and download_file operations.

Documentation

No documentation.

Test Plan

I had auto gpt download and append to files.

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

I didn't add any tests because I couldn't find out where or how to add them as I found other file operations didn't have tests.

hdkiller
hdkiller previously approved these changes Apr 26, 2023
Copy link
Member

@ntindle ntindle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests, take a look in the tests folder to see how it’s done

@ntindle ntindle linked an issue Apr 26, 2023 that may be closed by this pull request
1 task
@montanaflynn
Copy link
Contributor Author

Added tests

@vercel
Copy link

vercel bot commented Apr 26, 2023

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2023 4:01pm

@vercel vercel bot temporarily deployed to Preview April 26, 2023 11:36 Inactive
@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: +0.04 🎉

Comparison is base (9e17a30) 51.37% compared to head (6a7bb7a) 51.42%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3289      +/-   ##
==========================================
+ Coverage   51.37%   51.42%   +0.04%     
==========================================
  Files          65       65              
  Lines        3013     3016       +3     
  Branches      508      507       -1     
==========================================
+ Hits         1548     1551       +3     
- Misses       1338     1339       +1     
+ Partials      127      126       -1     
Impacted Files Coverage Δ
autogpt/commands/file_operations.py 57.81% <60.00%> (+1.01%) ⬆️

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

Pwuts
Pwuts previously requested changes Apr 26, 2023
autogpt/commands/file_operations.py Outdated Show resolved Hide resolved
autogpt/commands/file_operations.py Outdated Show resolved Hide resolved
tests/unit/test_file_operations.py Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview April 26, 2023 15:08 Inactive
@montanaflynn montanaflynn requested a review from Pwuts April 26, 2023 15:09
@vercel vercel bot temporarily deployed to Preview April 27, 2023 02:24 Inactive
@ntindle ntindle self-requested a review April 27, 2023 09:17
@Pwuts Pwuts added this to the v0.3.0 release milestone Apr 27, 2023
@vercel vercel bot temporarily deployed to Preview April 27, 2023 16:01 Inactive
@collijk collijk dismissed Pwuts’s stale review April 27, 2023 16:06

All feedback from the review has addressed

@collijk collijk merged commit 7cd76b8 into Significant-Gravitas:master Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

download_file fails when downloading to a folder that doesn't exist yet
5 participants