mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 20:55:09 +01:00
Add cleanup & move projects to their own directory
- Add optional argument to clean and delete the working directories of the project before running the prompt - Add `.gitignore` entry to ignore all possible projects - Update readme
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -36,3 +36,6 @@ archive
|
||||
|
||||
# any log file
|
||||
*log.txt
|
||||
|
||||
# ignore all project files
|
||||
projects
|
||||
@@ -24,12 +24,13 @@ GPT Engineer is made to be easy to adapt, extend, and make your agent learn how
|
||||
- `export OPENAI_API_KEY=[your api key]` with a key that has GPT4 access
|
||||
|
||||
**Run**:
|
||||
- Create a new empty folder with a `main_prompt` file (or copy the example folder `cp -r example/ my-new-project`)
|
||||
- Create a new empty folder with a `main_prompt` file in the `projects` folder (or copy the example folder `cp -r projects/example/ projects/my-new-project`)
|
||||
- Fill in the `main_prompt` in your new folder
|
||||
- Run `python -m gpt_engineer.main my-new-project`
|
||||
- Optionally pass in `true` to delete the working files before running
|
||||
|
||||
**Results**:
|
||||
- Check the generated files in my-new-project/workspace
|
||||
- Check the generated files in projects/my-new-project/workspace
|
||||
|
||||
### Limitations
|
||||
Implementing additional chain of thought prompting, e.g. [Reflexion](https://github.com/noahshinn024/reflexion), should be able to make it more reliable and not miss requested functionality in the main prompt.
|
||||
|
||||
@@ -2,8 +2,9 @@ import os
|
||||
import json
|
||||
import pathlib
|
||||
import typer
|
||||
import shutil
|
||||
|
||||
|
||||
from gpt_engineer.chat_to_files import to_files
|
||||
from gpt_engineer.ai import AI
|
||||
from gpt_engineer.steps import STEPS
|
||||
from gpt_engineer.db import DB, DBs
|
||||
@@ -14,7 +15,8 @@ app = typer.Typer()
|
||||
|
||||
@app.command()
|
||||
def chat(
|
||||
project_path: str = typer.Argument(str(pathlib.Path(os.path.curdir) / "example"), help="path"),
|
||||
project_path: str = typer.Argument("example", help="path"),
|
||||
delete_existing: str = typer.Argument(None, help="delete existing files"),
|
||||
run_prefix: str = typer.Option(
|
||||
"",
|
||||
help="run prefix, if you want to run multiple variants of the same project and later compare them",
|
||||
@@ -24,9 +26,14 @@ def chat(
|
||||
steps_config: str = "default",
|
||||
):
|
||||
app_dir = pathlib.Path(os.path.curdir)
|
||||
input_path = project_path
|
||||
memory_path = pathlib.Path(project_path) / (run_prefix + "memory")
|
||||
workspace_path = pathlib.Path(project_path) / (run_prefix + "workspace")
|
||||
input_path = pathlib.Path(app_dir / "projects" / project_path)
|
||||
memory_path = input_path / (run_prefix + "memory")
|
||||
workspace_path = input_path / (run_prefix + "workspace")
|
||||
|
||||
if delete_existing == 'true':
|
||||
# Delete files and subdirectories in paths
|
||||
shutil.rmtree(memory_path, ignore_errors=True)
|
||||
shutil.rmtree(workspace_path, ignore_errors=True)
|
||||
|
||||
ai = AI(
|
||||
model=model,
|
||||
|
||||
Reference in New Issue
Block a user