mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
check mmdc via running in case of setup failed.
This commit is contained in:
parent
22fd9fd49a
commit
748ef5535a
2 changed files with 3 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ from metagpt.logs import logger
|
|||
from metagpt.utils.common import check_cmd_exists
|
||||
|
||||
|
||||
def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height=2048):
|
||||
def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height=2048) -> int:
|
||||
"""suffix: png/svg/pdf
|
||||
|
||||
:param mermaid_code: mermaid code
|
||||
|
|
@ -29,6 +29,7 @@ def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height
|
|||
tmp.write_text(mermaid_code, encoding='utf-8')
|
||||
|
||||
if check_cmd_exists('mmdc') != 0:
|
||||
logger.warning("RUN `npm install -g @mermaid-js/mermaid-cli` to install mmdc")
|
||||
return -1
|
||||
|
||||
for suffix in ['pdf', 'svg', 'png']:
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -15,7 +15,7 @@ class InstallMermaidCLI(Command):
|
|||
|
||||
def run(self):
|
||||
try:
|
||||
subprocess.check_call(['sudo', 'npm', 'install', '-g', '@mermaid-js/mermaid-cli'])
|
||||
subprocess.check_call(['npm', 'install', '-g', '@mermaid-js/mermaid-cli'])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error occurred: {e.output}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue