mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-30 11:26:23 +02:00
refine writeprd code
This commit is contained in:
parent
007102e022
commit
8baa6d094f
13 changed files with 150 additions and 114 deletions
|
|
@ -21,6 +21,7 @@ from metagpt.const import (
|
|||
GRAPH_REPO_FILE_REPO,
|
||||
PRD_PDF_FILE_REPO,
|
||||
PRDS_FILE_REPO,
|
||||
REQUIREMENT_FILENAME,
|
||||
RESOURCES_FILE_REPO,
|
||||
SD_OUTPUT_FILE_REPO,
|
||||
SEQ_FLOW_FILE_REPO,
|
||||
|
|
@ -93,6 +94,10 @@ class ProjectRepo(FileRepository):
|
|||
self.test_outputs = self._git_repo.new_file_repository(relative_path=TEST_OUTPUTS_FILE_REPO)
|
||||
self._srcs_path = None
|
||||
|
||||
@property
|
||||
async def requirement(self):
|
||||
return await self.docs.get(filename=REQUIREMENT_FILENAME)
|
||||
|
||||
@property
|
||||
def git_repo(self) -> GitRepository:
|
||||
return self._git_repo
|
||||
|
|
@ -107,6 +112,15 @@ class ProjectRepo(FileRepository):
|
|||
raise ValueError("Call with_srcs first.")
|
||||
return self._git_repo.new_file_repository(self._srcs_path)
|
||||
|
||||
def code_files_exists(self) -> bool:
|
||||
git_workdir = self.git_repo.workdir
|
||||
src_workdir = git_workdir / git_workdir.name
|
||||
if not src_workdir.exists():
|
||||
return False
|
||||
code_files = self.with_src_path(path=git_workdir / git_workdir.name).srcs.all_files
|
||||
if not code_files:
|
||||
return False
|
||||
|
||||
def with_src_path(self, path: str | Path) -> ProjectRepo:
|
||||
try:
|
||||
self._srcs_path = Path(path).relative_to(self.workdir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue