Skip to content

Commit

Permalink
gpt-engineer self improvement fixes: Default to using existing file l…
Browse files Browse the repository at this point in the history
…ist file (AntonOsika#734)

* gpt-engineer self improving: only ask for confirmation once for -i flag

* Minor formatting

* Update colors
  • Loading branch information
AntonOsika authored Sep 22, 2023
1 parent 830b5c9 commit bdd535f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ docs/db/

poetry.lock
.aider*
.gpteng
9 changes: 8 additions & 1 deletion gpt_engineer/file_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tkinter.filedialog as fd

from pathlib import Path
from typing import List, Mapping, Union
from typing import List, Union

from gpt_engineer.db import DB, DBs

Expand Down Expand Up @@ -241,6 +241,13 @@ def ask_for_files(metadata_db: DB, workspace_db: DB) -> None:
Returns:
dict[str, str]: Dictionary where key = file name and value = file path
"""
if FILE_LIST_NAME in metadata_db:
print(
f"File list detected at {metadata_db.path / FILE_LIST_NAME}. "
"Edit or delete it if you want to select new files."
)
return

use_last_string = ""
if FILE_LIST_NAME in metadata_db:
use_last_string = (
Expand Down
6 changes: 3 additions & 3 deletions gpt_engineer/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def respec(ai: AI, dbs: DBs) -> List[Message]:
return messages


def gen_unit_tests(ai: AI, dbs: DBs) -> List[dict]:
def gen_unit_tests(ai: AI, dbs: DBs) -> List[Message]:
"""
Generate unit tests based on the specification, that should work.
"""
Expand Down Expand Up @@ -332,10 +332,10 @@ def get_improve_prompt(ai: AI, dbs: DBs):
"-----------------------------",
"The following files will be used in the improvement process:",
f"{FILE_LIST_NAME}:",
str(dbs.project_metadata["file_list.txt"]),
colored(str(dbs.project_metadata[FILE_LIST_NAME]), "green"),
"",
"The inserted prompt is the following:",
f"'{dbs.input['prompt']}'",
colored(f"{dbs.input['prompt']}", "green"),
"-----------------------------",
"",
"You can change these files in your project before proceeding.",
Expand Down

0 comments on commit bdd535f

Please sign in to comment.