feat: Change the operation of transmitting file content during the QA process to transmitting file names instead.

This commit is contained in:
莘权 马 2023-11-23 22:41:44 +08:00
parent 13b37306cd
commit ec3dd004af
8 changed files with 159 additions and 151 deletions

View file

@ -19,6 +19,7 @@ from typing import Dict, List, Optional, Set, TypedDict
from pydantic import BaseModel, Field
from metagpt.config import CONFIG
from metagpt.const import (
MESSAGE_ROUTE_CAUSE_BY,
MESSAGE_ROUTE_FROM,
@ -59,6 +60,12 @@ class Document(BaseModel):
"""
return os.path.join(self.root_path, self.filename)
@property
def full_path(self):
if not CONFIG.git_repo:
return None
return str(CONFIG.git_repo.workdir / self.root_path / self.filename)
class Documents(BaseModel):
"""A class representing a collection of documents.
@ -245,3 +252,22 @@ class CodingContext(BaseModel):
design_doc: Document
task_doc: Document
code_doc: Document
class TestingContext(BaseModel):
filename: str
code_doc: Document
test_doc: Document
class RunCodeContext(BaseModel):
mode: str = "script"
code: Optional[str]
code_filename: str = ""
test_code: Optional[str]
test_filename: str = ""
command: List[str] = Field(default_factory=list)
working_directory: str = ""
additional_python_paths: List[str] = Field(default_factory=list)
output_filename: Optional[str]
output: Optional[str]