This commit is contained in:
tjb-tech
2025-02-17 00:00:01 +08:00
parent 3c9913338f
commit b915ae9d8d
11 changed files with 17 additions and 21 deletions

View File

@@ -46,12 +46,13 @@ Welcome to AutoAgent! AutoAgent is a **Fully-Automated** and highly **Self-Devel
<div align="center">
<!-- <img src="./assets/AutoAgentnew-intro.pdf" alt="Logo" width="100%"> -->
<figure>
<img src="./assets/AutoAgent-intro-final.svg" alt="Logo" style="max-width: 100%; height: auto;">
<img src="./assets/autoagent-intro.svg" alt="Logo" style="max-width: 100%; height: auto;">
<figcaption><em>Quick Overview of AutoAgent.</em></figcaption>
</figure>
</div>
## 🔥 News
<div class="scrollable">

View File

Before

Width:  |  Height:  |  Size: 616 KiB

After

Width:  |  Height:  |  Size: 616 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.1 MiB

After

Width:  |  Height:  |  Size: 7.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 KiB

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -105,7 +105,7 @@ def clear_screen():
console = Console()
console.print("[bold green]Coming soon...[/bold green]")
print('\033[u\033[J\033[?25h', end='') # Restore cursor and clear everything after it, show cursor
def get_config(container_name, port):
def get_config(container_name, port, test_pull_name="main", git_clone=False):
container_name = container_name
port_info = check_container_ports(container_name)
@@ -129,13 +129,14 @@ def get_config(container_name, port):
f.write(container_name)
local_root = os.path.join(os.getcwd(), f"workspace_meta_showcase", f"showcase_{container_name}")
os.makedirs(local_root, exist_ok=True)
print("port: ", port)
docker_config = DockerConfig(
workplace_name=DOCKER_WORKPLACE_NAME,
container_name=container_name,
communication_port=port,
conda_path='/root/miniconda3',
local_root=local_root,
test_pull_name=test_pull_name,
git_clone=git_clone
)
return docker_config
def create_environment(docker_config: DockerConfig):
@@ -162,15 +163,14 @@ def update_guidance(context_variables):
console.print(Panel(NOTES,title="Important Notes", expand=True))
@cli.command(name='main') # 修改这里,使用连字符
@click.option('--container_name', default='quick_start', help='the function to get the agent')
@click.option('--port', default=12345, help='the port to run the container')
@click.option('--container_name', default='auto_agent', help='the function to get the agent')
@click.option('--port', default=12347, help='the port to run the container')
@click.option('--test_pull_name', default='autoagent_mirror', help='the name of the test pull')
@click.option('--git_clone', default=True, help='whether to clone a mirror of the repository')
def main(container_name: str, port: int, test_pull_name: str, git_clone: bool):
"""
Run deep research with a given model, container name, port
"""
print(f"port: {port}")
model = COMPLETION_MODEL
print('\033[s\033[?25l', end='') # Save cursor position and hide cursor
with Progress(
@@ -181,7 +181,7 @@ def main(container_name: str, port: int, test_pull_name: str, git_clone: bool):
task = progress.add_task("[cyan]Initializing...", total=None)
progress.update(task, description="[cyan]Initializing config...[/cyan]\n")
docker_config = get_config(container_name, port)
docker_config = get_config(container_name, port, test_pull_name, git_clone)
progress.update(task, description="[cyan]Setting up logger...[/cyan]\n")
log_path = osp.join("casestudy_results", 'logs', f'agent_{container_name}_{model}.log')
@@ -297,7 +297,6 @@ def deep_research(container_name: str, port: int):
"""
Run deep research with a given model, container name, port
"""
print(f"port: {port}")
model = COMPLETION_MODEL
print('\033[s\033[?25l', end='') # Save cursor position and hide cursor
with Progress(

View File

@@ -52,25 +52,25 @@ class DockerEnv:
unzip_command = ["tar", "-xzvf", f"packages/{self.setup_package}.tar.gz", "-C", self.local_workplace]
subprocess.run(unzip_command)
if self.git_clone:
if not os.path.exists(os.path.join(self.local_workplace, 'MetaChain')):
git_command = ["cd", self.local_workplace, "&&", "git", "clone", "-b", self.test_pull_name, f"https://{AI_USER}:{GITHUB_AI_TOKEN}@github.com/HKUDS/MetaChain.git"]
if not os.path.exists(os.path.join(self.local_workplace, 'AutoAgent')):
git_command = ["cd", self.local_workplace, "&&", "git", "clone", "-b", self.test_pull_name, f"https://{AI_USER}:{GITHUB_AI_TOKEN}@github.com/HKUDS/AutoAgent.git"]
print(git_command)
git_command = " ".join(git_command)
result = subprocess.run(git_command, shell=True)
if result.returncode != 0:
raise Exception(f"Failed to clone the repository. The error is: {result.stdout}")
copy_env_command = f"cp .env {self.local_workplace}/MetaChain"
copy_env_command = f"cp .env {self.local_workplace}/AutoAgent"
result = subprocess.run(copy_env_command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise Exception(f"Failed to copy .env file to the MetaChain directory. Error: {result.stderr}")
raise Exception(f"Failed to copy .env file to the AutoAgent directory. Error: {result.stderr}")
# create a new branch
new_branch_name = f"{self.test_pull_name}_{self.task_name}"
create_branch_command = f"cd {self.local_workplace}/MetaChain && git checkout -b {new_branch_name}"
create_branch_command = f"cd {self.local_workplace}/AutoAgent && git checkout -b {new_branch_name}"
result = subprocess.run(create_branch_command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(Exception(f"Failed to create and switch to new branch. Error: {result.stderr}"))
switch_branch_command = f"cd {self.local_workplace}/MetaChain && git checkout {new_branch_name}"
switch_branch_command = f"cd {self.local_workplace}/AutoAgent && git checkout {new_branch_name}"
result = subprocess.run(switch_branch_command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise Exception(f"Failed to switch to new branch. Error: {result.stderr}")

View File

@@ -7,7 +7,7 @@ def setup_metachain(workplace_name: str, env: DockerEnv):
if response['status'] == 0:
print("AutoAgent is already installed.")
return
cmd = f"cd /{workplace_name}/MetaChain && pip install -e ."
cmd = f"cd /{workplace_name}/AutoAgent && pip install -e ."
response = env.run_command(cmd, print_stream)
if response['status'] == 0:
print("AutoAgent is installed.")

View File

@@ -24,7 +24,7 @@ def str_to_bool(value):
DOCKER_WORKPLACE_NAME = os.getenv('DOCKER_WORKPLACE_NAME', 'workplace')
GITHUB_AI_TOKEN = os.getenv('GITHUB_AI_TOKEN', None)
AI_USER = os.getenv('AI_USER', None)
AI_USER = os.getenv('AI_USER', "tjb-tech")
LOCAL_ROOT = os.getenv('LOCAL_ROOT', os.getcwd())
DEBUG = str_to_bool(os.getenv('DEBUG', False))