mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-23 15:48:11 +02:00
separate workspace
This commit is contained in:
parent
882c66ba2a
commit
dc14770e3d
15 changed files with 275 additions and 275 deletions
|
|
@ -8,7 +8,7 @@ from functools import wraps
|
|||
from importlib import import_module
|
||||
|
||||
from metagpt.actions import Action, ActionOutput, WritePRD
|
||||
from metagpt.const import WORKSPACE_ROOT
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles import Role
|
||||
from metagpt.schema import Message
|
||||
|
|
@ -214,7 +214,7 @@ class UIDesign(Action):
|
|||
logger.info("Finish icon design using StableDiffusion API")
|
||||
|
||||
async def _save(self, css_content, html_content):
|
||||
save_dir = WORKSPACE_ROOT / "resources" / "codes"
|
||||
save_dir = CONFIG.workspace / "resources" / "codes"
|
||||
if not os.path.exists(save_dir):
|
||||
os.makedirs(save_dir, exist_ok=True)
|
||||
# Save CSS and HTML content to files
|
||||
|
|
|
|||
|
|
@ -8,11 +8,8 @@
|
|||
@Modified By: mashenquan, 2023-8-17, move to `tools` folder.
|
||||
"""
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parent.parent.parent.parent)) # fix-bug: No module named 'metagpt'
|
||||
from metagpt.const import WORKSPACE_ROOT
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.tools.azure_tts import AzureTTS
|
||||
|
||||
|
||||
|
|
@ -28,15 +25,13 @@ def test_azure_tts():
|
|||
“Writing a binary file in Python is similar to writing a regular text file, but you'll work with bytes instead of strings.”
|
||||
</mstts:express-as>
|
||||
"""
|
||||
path = WORKSPACE_ROOT / "tts"
|
||||
path = CONFIG.workspace / "tts"
|
||||
path.mkdir(exist_ok=True, parents=True)
|
||||
filename = path / "girl.wav"
|
||||
loop = asyncio.new_event_loop()
|
||||
v = loop.create_task(azure_tts.synthesize_speech(
|
||||
lang="zh-CN",
|
||||
voice="zh-CN-XiaomoNeural",
|
||||
text=text,
|
||||
output_file=str(filename)))
|
||||
v = loop.create_task(
|
||||
azure_tts.synthesize_speech(lang="zh-CN", voice="zh-CN-XiaomoNeural", text=text, output_file=str(filename))
|
||||
)
|
||||
result = loop.run_until_complete(v)
|
||||
|
||||
print(result)
|
||||
|
|
@ -45,5 +40,5 @@ def test_azure_tts():
|
|||
# TODO: 这里如果要检验,还要额外加上对应的asr,才能确保前后生成是接近一致的,但现在还没有
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
test_azure_tts()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
#
|
||||
import os
|
||||
|
||||
from metagpt.tools.sd_engine import SDEngine, WORKSPACE_ROOT
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.tools.sd_engine import SDEngine
|
||||
|
||||
|
||||
def test_sd_engine_init():
|
||||
|
|
@ -21,5 +22,5 @@ def test_sd_engine_generate_prompt():
|
|||
async def test_sd_engine_run_t2i():
|
||||
sd_engine = SDEngine()
|
||||
await sd_engine.run_t2i(prompts=["test"])
|
||||
img_path = WORKSPACE_ROOT / "resources" / "SD_Output" / "output_0.png"
|
||||
img_path = CONFIG.workspace / "resources" / "SD_Output" / "output_0.png"
|
||||
assert os.path.exists(img_path) == True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue