mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 12:45:26 +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:
@@ -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