Update prompt and fix up some bug

This commit is contained in:
mannaandpoem 2024-01-04 10:41:36 +08:00
parent 0168c99323
commit e3cd1a2cc1
9 changed files with 35 additions and 60 deletions

View file

@ -425,7 +425,7 @@ class WriteCodeGuideline(Action):
async def main():
write_code_guideline = WriteCodeGuideline()
node = await write_code_guideline.run(CODE_GUIDELINE_CONTEXT_EXAMPLE)
guideline = node.instruct_content.json(ensure_ascii=False)
guideline = node.instruct_content.model_dump_json()
print(guideline)

View file

@ -214,7 +214,7 @@ Based on New Requirements, output a New PRD that seamlessly integrates both the
"""
REFINE_PRD_TEMPLATE = """
### New Project Name
### Project Name
{project_name}
### New Requirements

View file

@ -346,7 +346,7 @@ class Engineer(Role):
context = CODE_GUIDELINE_CONTEXT.format(requirement=requirement, tasks=tasks, design=design, code=old_codes)
node = await WriteCodeGuideline().run(context=context)
guideline = node.instruct_content.json(ensure_ascii=False)
guideline = node.instruct_content.model_dump_json()
return guideline
@staticmethod

View file

@ -189,7 +189,7 @@ class GitRepository:
return self._dependency
def rename_root(self, new_dir_name):
"""Rename/Copy the root directory of the Git repository.
"""Rename the root directory of the Git repository.
:param new_dir_name: The new name for the root directory.
"""
@ -200,15 +200,10 @@ class GitRepository:
logger.info(f"Delete directory {str(new_path)}")
shutil.rmtree(new_path)
try:
shutil.copytree(src=str(self.workdir), dst=str(new_path))
shutil.move(src=str(self.workdir), dst=str(new_path))
except Exception as e:
logger.warning(f"Copy {str(self.workdir)} to {str(new_path)} error: {e}")
logger.info(f"Copy directory {str(self.workdir)} to {str(new_path)}")
# try:
# shutil.move(src=str(self.workdir), dst=str(new_path))
# except Exception as e:
# logger.warning(f"Move {str(self.workdir)} to {str(new_path)} error: {e}")
# logger.info(f"Rename directory {str(self.workdir)} to {str(new_path)}")
logger.warning(f"Move {str(self.workdir)} to {str(new_path)} error: {e}")
logger.info(f"Rename directory {str(self.workdir)} to {str(new_path)}")
self._repository = Repo(new_path)
self._gitignore_rules = parse_gitignore(full_path=str(new_path / ".gitignore"))