mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
Merge branch 'mgx_ops' into add_swe_agent_ablilities_to_engineer2
This commit is contained in:
commit
5da4ac60a7
5 changed files with 8 additions and 6 deletions
|
|
@ -231,7 +231,7 @@ class WriteDesign(Action):
|
|||
async def _save_mermaid_file(self, data: str, pathname: Path):
|
||||
pathname.parent.mkdir(parents=True, exist_ok=True)
|
||||
await mermaid_to_file(self.config.mermaid.engine, data, pathname)
|
||||
image_path = pathname.parent / f"{pathname.name}.png"
|
||||
image_path = pathname.parent / f"{pathname.name}.svg"
|
||||
if image_path.exists():
|
||||
await GalleryReporter().async_report(image_path, "path")
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ class WritePRD(Action):
|
|||
pathname = output_filename or self.repo.workdir / COMPETITIVE_ANALYSIS_FILE_REPO / Path(prd_doc.filename).stem
|
||||
pathname.parent.mkdir(parents=True, exist_ok=True)
|
||||
await mermaid_to_file(self.config.mermaid.engine, quadrant_chart, pathname)
|
||||
image_path = pathname.parent / f"{pathname.name}.png"
|
||||
image_path = pathname.parent / f"{pathname.name}.svg"
|
||||
if image_path.exists():
|
||||
await GalleryReporter().async_report(image_path, "path")
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ class BaseRole:
|
|||
"""Abstract base class for all roles."""
|
||||
|
||||
name: str
|
||||
is_idle: bool
|
||||
|
||||
@property
|
||||
def is_idle(self) -> bool:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def think(self):
|
||||
|
|
|
|||
|
|
@ -300,7 +300,6 @@ class BaseLLM(ABC):
|
|||
if compress_type == CompressType.NO_COMPRESS:
|
||||
return messages
|
||||
|
||||
current_token_count = 0
|
||||
max_token = TOKEN_MAX.get(self.config.model, max_token)
|
||||
keep_token = int(max_token * threshold)
|
||||
compressed = []
|
||||
|
|
@ -318,7 +317,7 @@ class BaseLLM(ABC):
|
|||
# system_msgs = [msg for msg in messages if msg["role"] == system_msg_val]
|
||||
# user_assistant_msgs = [msg for msg in messages if msg["role"] != system_msg_val]
|
||||
compressed.extend(system_msgs)
|
||||
current_token_count += self.count_tokens(system_msgs)
|
||||
current_token_count = self.count_tokens(system_msgs)
|
||||
|
||||
if compress_type in [CompressType.POST_CUT_BY_TOKEN, CompressType.POST_CUT_BY_MSG]:
|
||||
# Under keep_token constraint, keep as many latest messages as possible
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ async def mermaid_to_file(
|
|||
Returns:
|
||||
int: 0 if the conversion is successful, -1 if the conversion fails.
|
||||
"""
|
||||
suffixes = suffixes or ["png"]
|
||||
suffixes = suffixes or ["svg"]
|
||||
# Write the Mermaid code to a temporary file
|
||||
config = config if config else Config.default()
|
||||
dir_name = os.path.dirname(output_file_without_suffix)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue