mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
update function of save code_guideline file
This commit is contained in:
parent
fe64b23a0e
commit
2bc88cd71b
2 changed files with 8 additions and 14 deletions
|
|
@ -187,20 +187,15 @@ class WriteCodeGuideline(Action):
|
|||
return await WRITE_CODE_GUIDELINE_NODE.fill(context=context, llm=self.llm, schema="json")
|
||||
|
||||
@staticmethod
|
||||
async def save(guideline):
|
||||
await WriteCodeGuideline.save_json(guideline)
|
||||
await WriteCodeGuideline.save_md(guideline)
|
||||
|
||||
@staticmethod
|
||||
async def save_json(guideline):
|
||||
filename = "code_guideline.json"
|
||||
async def save_json(guideline, filename="code_guideline.json"):
|
||||
await CONFIG.git_repo.new_file_repository(CODE_GUIDELINE_FILE_REPO).save(
|
||||
filename=filename, content=str(guideline)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
async def save_md(guideline):
|
||||
filename = "code_guideline.md"
|
||||
async def save_md(guideline, filename="code_guideline.md"):
|
||||
guideline_md = dict_to_markdown(guideline)
|
||||
await CONFIG.git_repo.new_file_repository(CODE_GUIDELINE_PDF_FILE_REPO).save(
|
||||
filename=filename, content=dict_to_markdown(guideline)
|
||||
filename=filename, content=guideline_md
|
||||
)
|
||||
return guideline_md
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ from pathlib import Path
|
|||
from typing import Set
|
||||
|
||||
from metagpt.actions import Action, WriteCode, WriteCodeReview, WriteTasks
|
||||
from metagpt.actions.action_node import dict_to_markdown
|
||||
from metagpt.actions.fix_bug import FixBug
|
||||
from metagpt.actions.summarize_code import SummarizeCode
|
||||
from metagpt.actions.write_code_guideline_an import (
|
||||
|
|
@ -367,10 +366,10 @@ class Engineer(Role):
|
|||
)
|
||||
node = await WriteCodeGuideline().run(context=context)
|
||||
guideline = node.instruct_content.model_dump()
|
||||
await WriteCodeGuideline.save(guideline)
|
||||
guideline = dict_to_markdown(guideline)
|
||||
await WriteCodeGuideline.save_json(guideline)
|
||||
guideline_md = await WriteCodeGuideline.save_md(guideline)
|
||||
|
||||
return Document(root_path=CODE_GUIDELINE_PDF_FILE_REPO, filename="code_guideline.md", content=guideline)
|
||||
return Document(root_path=CODE_GUIDELINE_PDF_FILE_REPO, filename="code_guideline.md", content=guideline_md)
|
||||
|
||||
@staticmethod
|
||||
async def get_old_codes() -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue