smol-ai / developer

the first library to let you embed a developer agent in your own app!
https://twitter.com/SmolModels
MIT License
11.81k stars 1.03k forks source link

Fix: File Permission Error #43

Closed billysweird closed 1 year ago

billysweird commented 1 year ago

Updated to check if writing to file or directory, Saves time and don't have to write large complicated prompts, should normally sort itself out instead.

For example without this with a simple prompt it may try and write a single files code to a directory name, and get a Error 13: Permission error. Instead this will check if the file_path is a directory or a file first, it seems that the handler response is enough to trigger the AI to look inside the directory to write the multiple files it needs to, instead of treating a directory like a file and trying to save files or write files to it.

And also using os.path.join is standard for cross-platform forgot to add this point instead of manually setting it with directory + "/" + filename, Avoids uni-code conflicts.

Just ignore the gitignore and parameter settings, you can just accept the update to the file system.