diff --git a/pilot/helpers/AgentConvo.py b/pilot/helpers/AgentConvo.py index 47b2045cc5..18d64a5470 100644 --- a/pilot/helpers/AgentConvo.py +++ b/pilot/helpers/AgentConvo.py @@ -89,7 +89,7 @@ class AgentConvo: raise e # TODO: move this code to Developer agent - https://github.com/Pythagora-io/gpt-pilot/issues/91#issuecomment-1751964079 - if self.agent.__class__.__name__ == 'Developer': + if self.agent.__class__.__name__ == 'Developer' or self.agent.__class__.__name__ == 'TechnicalWriter': save_development_step(self.agent.project, prompt_path, prompt_data, self.messages, response) # TODO handle errors from OpenAI diff --git a/pilot/helpers/agents/Developer.py b/pilot/helpers/agents/Developer.py index b6644b060e..99070409b3 100644 --- a/pilot/helpers/agents/Developer.py +++ b/pilot/helpers/agents/Developer.py @@ -65,7 +65,7 @@ class Developer(Agent): self.implement_task(i, dev_task) # DEVELOPMENT END - self.project.technical_writer.document_project('100') + self.project.technical_writer.document_project(100) self.project.dot_pilot_gpt.chat_log_folder(None) if not self.project.finished: self.project.current_step = 'finished' diff --git a/pilot/utils/files.py b/pilot/utils/files.py index 8671203120..97bf02888e 100644 --- a/pilot/utils/files.py +++ b/pilot/utils/files.py @@ -44,14 +44,4 @@ def create_directory(parent_directory, new_directory): def count_lines_of_code(files): - total_lines = 0 - - for file in files: - # Split the content into lines - lines = file['content'].split('\n') - - # Count the lines, skipping empty lines and comments if desired - line_count = sum(1 for line in lines if line.strip() and not line.strip().startswith('//')) - total_lines += line_count - - return total_lines + return sum(len(file['content'].splitlines()) for file in files)