From bdd535ff8f66af0284890d96f205c1e74e7f93d1 Mon Sep 17 00:00:00 2001 From: Anton Osika Date: Fri, 22 Sep 2023 23:05:55 +0200 Subject: [PATCH] gpt-engineer self improvement fixes: Default to using existing file list file (#734) * gpt-engineer self improving: only ask for confirmation once for -i flag * Minor formatting * Update colors --- .gitignore | 1 + gpt_engineer/file_selector.py | 9 ++++++++- gpt_engineer/steps.py | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 24a9cb4ee0..9753953afa 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,4 @@ docs/db/ poetry.lock .aider* +.gpteng diff --git a/gpt_engineer/file_selector.py b/gpt_engineer/file_selector.py index f9baa2d7f4..8865f545ff 100644 --- a/gpt_engineer/file_selector.py +++ b/gpt_engineer/file_selector.py @@ -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 @@ -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 = ( diff --git a/gpt_engineer/steps.py b/gpt_engineer/steps.py index f8bfa70de8..741a419bbc 100644 --- a/gpt_engineer/steps.py +++ b/gpt_engineer/steps.py @@ -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. """ @@ -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.",