Merge branch 'dynamic_think' into 'mgx_ops'

import git, add terminal state

See merge request pub/MetaGPT!94
This commit is contained in:
林义章 2024-05-09 02:23:44 +00:00
commit 466146cea4
3 changed files with 10 additions and 2 deletions

View file

@ -15,6 +15,7 @@ from metagpt.tools.libs import (
file_manager,
browser,
deployer,
git,
)
from metagpt.tools.libs.env import get_env, set_get_env_entry, default_get_env, get_env_description
@ -29,6 +30,7 @@ _ = (
file_manager,
browser,
deployer,
git,
get_env,
get_env_description,
set_get_env_entry,

View file

@ -12,8 +12,8 @@ from metagpt.tools.tool_registry import register_tool
from metagpt.utils.git_repository import GitBranch, GitRepository
@register_tool(tags=["software development", "git", "Clone a git repository to local"])
async def git_clone(url: Union[str, Path], output_dir: Union[str, Path] = None) -> Path:
# @register_tool(tags=["git"])
async def git_clone(url: str, output_dir: str | Path = None) -> Path:
"""
Clones a Git repository from the given URL.

View file

@ -33,6 +33,12 @@ class Terminal:
self.stdout_queue = Queue()
self.observer = TerminalReporter()
self._check_state()
def _check_state(self):
"""Check the state of the terminal, e.g. the current directory of the terminal process. Useful for agent to understand."""
print("The terminal is at:", self.run_command("pwd"))
def run_command(self, cmd: str, daemon=False) -> str:
"""
Executes a specified command in the terminal and streams the output back in real time.