mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-24 14:15:17 +02:00
import git, add terminal state
This commit is contained in:
parent
445db9074b
commit
d8c2d1c707
3 changed files with 10 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from metagpt.tools.tool_registry import register_tool
|
|||
from metagpt.utils.git_repository import GitRepository
|
||||
|
||||
|
||||
@register_tool(tags=["git"])
|
||||
# @register_tool(tags=["git"])
|
||||
async def git_clone(url: str, output_dir: str | Path = None) -> Path:
|
||||
"""
|
||||
Clones a Git repository from the given URL.
|
||||
|
|
|
|||
|
|
@ -28,10 +28,16 @@ class Terminal:
|
|||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
bufsize=1, # Line buffered
|
||||
executable="/bin/bash"
|
||||
executable="/bin/bash",
|
||||
)
|
||||
self.stdout_queue = Queue()
|
||||
|
||||
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue