allow di to use terminal tool, add tool log fn, expand truncate len

This commit is contained in:
yzlin 2024-03-30 17:11:11 +08:00
parent 3e10d34468
commit 53240b91f2
7 changed files with 118 additions and 2 deletions

View file

@ -0,0 +1,15 @@
from metagpt.const import DATA_PATH, METAGPT_ROOT
from metagpt.tools.libs.terminal import Terminal
def test_terminal():
terminal = Terminal()
terminal.run_command(f"cd {METAGPT_ROOT}")
output = terminal.run_command("pwd")
assert output.strip() == str(METAGPT_ROOT)
# pwd now should be METAGPT_ROOT, cd data should land in DATA_PATH
terminal.run_command("cd data")
output = terminal.run_command("pwd")
assert output.strip() == str(DATA_PATH)