From a5a80ee430436306ab87788817dda07152778431 Mon Sep 17 00:00:00 2001 From: LeonOstrez Date: Tue, 3 Oct 2023 13:00:33 +0100 Subject: [PATCH 1/2] fix asking for human intervention in extension --- pilot/helpers/Project.py | 30 +++++++++++++++--------------- pilot/prompts/prompts.py | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pilot/helpers/Project.py b/pilot/helpers/Project.py index c1285b3..422886c 100644 --- a/pilot/helpers/Project.py +++ b/pilot/helpers/Project.py @@ -71,7 +71,6 @@ class Project: # if development_plan is not None: # self.development_plan = development_plan - def start(self): """ Start the project. @@ -124,7 +123,8 @@ class Project: if should_overwrite_files == 'n': break elif should_overwrite_files == 'y': - FileSnapshot.delete().where(FileSnapshot.app == self.app and FileSnapshot.development_step == self.skip_until_dev_step).execute() + FileSnapshot.delete().where( + FileSnapshot.app == self.app and FileSnapshot.development_step == self.skip_until_dev_step).execute() self.save_files_snapshot(self.skip_until_dev_step) break # TODO END @@ -230,11 +230,11 @@ class Project: update_file(data['full_path'], data['content']) (File.insert(app=self.app, path=data['path'], name=data['name'], full_path=data['full_path']) - .on_conflict( - conflict_target=[File.app, File.name, File.path], - preserve=[], - update={ 'name': data['name'], 'path': data['path'], 'full_path': data['full_path'] }) - .execute()) + .on_conflict( + conflict_target=[File.app, File.name, File.path], + preserve=[], + update={'name': data['name'], 'path': data['path'], 'full_path': data['full_path']}) + .execute()) def get_full_file_path(self, file_path: str, file_name: str) -> Tuple[str, str]: @@ -334,16 +334,16 @@ class Project: def ask_for_human_intervention(self, message, description=None, cbs={}, convo=None, is_root_task=False): answer = '' + question = yellow_bold(message) + + if description is not None: + question += '\n' + '-' * 100 + '\n' + white_bold(description) + '\n' + '-' * 100 + '\n' + if convo is not None: reset_branch_id = convo.save_branch() while answer != 'continue': - if description is not None: - print('\n' + '-'*100 + '\n' + - white_bold(description) + - '\n' + '-'*100 + '\n') - - answer = ask_user(self, yellow_bold(message), + answer = ask_user(self, question, require_some_input=False, hint='If something is wrong, tell me or type "continue" to continue.') @@ -351,11 +351,11 @@ class Project: if answer in cbs: return cbs[answer](convo) elif answer != '': - return { 'user_input': answer } + return {'user_input': answer} except TokenLimitError as e: if is_root_task and answer not in cbs and answer != '': convo.load_branch(reset_branch_id) - return { 'user_input': answer } + return {'user_input': answer} else: raise e diff --git a/pilot/prompts/prompts.py b/pilot/prompts/prompts.py index 5d95da9..6a6061d 100644 --- a/pilot/prompts/prompts.py +++ b/pilot/prompts/prompts.py @@ -52,7 +52,7 @@ def ask_for_main_app_definition(project): def ask_user(project, question: str, require_some_input=True, hint: str = None): while True: if hint is not None: - print(hint, type='hint') + print(yellow(hint), type='hint') answer = styled_text(project, question) logger.info('Q: %s', question) From 1b9ee8b5167c5238e7cdd23c16ed51589b981699 Mon Sep 17 00:00:00 2001 From: LeonOstrez Date: Tue, 3 Oct 2023 23:21:11 +0100 Subject: [PATCH 2/2] add second blog post to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdfc5be..9c12c40 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ I've broken down the idea behind GPT Pilot and how it works in the following blo **[[Part 1/3] High-level concepts + GPT Pilot workflow until the coding part](https://blog.pythagora.ai/2023/08/23/430/)** -**_[Part 2/3] GPT Pilot coding workflow (COMING UP)_** +**_[[Part 2/3] GPT Pilot coding workflow](https://blog.pythagora.ai/2023/09/04/gpt-pilot-coding-workflow-part-2-3/)_** **_[Part 3/3] Other important concepts and future plans (COMING UP)_**