From 41b6bd23e21003430dec4a1ff4d7ca3ad0df5a1a Mon Sep 17 00:00:00 2001 From: Zvonimir Sabljic Date: Wed, 23 Aug 2023 14:50:00 +0200 Subject: [PATCH] Fixes --- pilot/helpers/Project.py | 15 ++++++++------- pilot/helpers/agents/Developer.py | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pilot/helpers/Project.py b/pilot/helpers/Project.py index 7e41841..c55a6aa 100644 --- a/pilot/helpers/Project.py +++ b/pilot/helpers/Project.py @@ -90,7 +90,7 @@ class Project: def get_all_coded_files(self): files = File.select().where(File.app_id == self.args['app_id']) - files = self.get_files([file.path + file.name for file in files]) + files = self.get_files([file.path + '/' + file.name for file in files]) return files def get_files(self, files): @@ -110,6 +110,10 @@ class Project: return files_with_content def save_file(self, data): + # TODO fix this in prompts + if ' ' in data['name'] or '.' not in data['name']: + data['name'] = data['path'].rsplit('/', 1)[1] + data['path'], data['full_path'] = self.get_full_file_path(data['path'], data['name']) update_file(data['full_path'], data['content']) @@ -122,10 +126,7 @@ class Project: def get_full_file_path(self, file_path, file_name): file_path = file_path.replace('./', '', 1) - if ' ' in file_name or '.' not in file_name: - file_name = '' - else: - file_path = file_path.rsplit(file_name, 1)[0] + file_path = file_path.rsplit(file_name, 1)[0] if file_path.endswith('/'): file_path = file_path.rstrip('/') @@ -133,7 +134,7 @@ class Project: if file_name.startswith('/'): file_name = file_name[1:] - if not file_path.startswith('/'): + if not file_path.startswith('/') and file_path != '': file_path = '/' + file_path if file_name != '': @@ -189,5 +190,5 @@ class Project: if answer in cbs: return cbs[answer]() - elif answer != '' and answer != 'continue': + elif answer != '': return answer diff --git a/pilot/helpers/agents/Developer.py b/pilot/helpers/agents/Developer.py index a5cace6..3afe0a1 100644 --- a/pilot/helpers/agents/Developer.py +++ b/pilot/helpers/agents/Developer.py @@ -89,7 +89,7 @@ class Developer(Agent): elif step['type'] == 'human_intervention': user_feedback = self.project.ask_for_human_intervention('I need your help! Can you try debugging this yourself and let me take over afterwards? Here are the details about the issue:', step['human_intervention_description']) - if user_feedback is not None: + if user_feedback is not None and user_feedback != 'continue': debug(convo, user_input=user_feedback, issue_description=step['human_intervention_description']) if test_command is not None and ('check_if_fixed' not in step or step['check_if_fixed']): @@ -117,7 +117,7 @@ class Developer(Agent): 'Can you check if the app works?\nIf you want to run the app, ' + colored('just type "r" and press ENTER', 'yellow', attrs=['bold']), cbs={ 'r': lambda: run_command_until_success(self.run_command, None, iteration_convo, force=True) }) - if user_feedback == 'DONE': + if user_feedback == 'continue': return True if user_feedback is not None: