Run deep research with a given model, container name, port
(container_name: str, port: int, test_pull_name: str, git_clone: bool, local_env: bool)
| 183 | @click.option('--git_clone', default=True, help='whether to clone a mirror of the repository') |
| 184 | @click.option('--local_env', default=False, help='whether to use local environment') |
| 185 | def main(container_name: str, port: int, test_pull_name: str, git_clone: bool, local_env: bool): |
| 186 | """ |
| 187 | Run deep research with a given model, container name, port |
| 188 | """ |
| 189 | model = COMPLETION_MODEL |
| 190 | print('\033[s\033[?25l', end='') # Save cursor position and hide cursor |
| 191 | with Progress( |
| 192 | SpinnerColumn(), |
| 193 | TextColumn("[progress.description]{task.description}"), |
| 194 | transient=True # 这会让进度条完成后消失 |
| 195 | ) as progress: |
| 196 | task = progress.add_task("[cyan]Initializing...", total=None) |
| 197 | |
| 198 | progress.update(task, description="[cyan]Initializing config...[/cyan]\n") |
| 199 | docker_config = get_config(container_name, port, test_pull_name, git_clone) |
| 200 | |
| 201 | progress.update(task, description="[cyan]Setting up logger...[/cyan]\n") |
| 202 | log_path = osp.join("casestudy_results", 'logs', f'agent_{container_name}_{model}.log') |
| 203 | LoggerManager.set_logger(MetaChainLogger(log_path = None)) |
| 204 | |
| 205 | progress.update(task, description="[cyan]Creating environment...[/cyan]\n") |
| 206 | if local_env: |
| 207 | code_env, web_env, file_env = create_environment_local(docker_config) |
| 208 | else: |
| 209 | code_env, web_env, file_env = create_environment(docker_config) |
| 210 | |
| 211 | progress.update(task, description="[cyan]Setting up autoagent...[/cyan]\n") |
| 212 | |
| 213 | clear_screen() |
| 214 | |
| 215 | context_variables = {"working_dir": docker_config.workplace_name, "code_env": code_env, "web_env": web_env, "file_env": file_env} |
| 216 | |
| 217 | # select the mode |
| 218 | while True: |
| 219 | update_guidance(context_variables) |
| 220 | mode = single_select_menu(['user mode', 'agent editor', 'workflow editor', 'exit'], "Please select the mode:") |
| 221 | match mode: |
| 222 | case 'user mode': |
| 223 | clear_screen() |
| 224 | user_mode(model, context_variables, False) |
| 225 | case 'agent editor': |
| 226 | clear_screen() |
| 227 | meta_agent(model, context_variables, False) |
| 228 | case 'workflow editor': |
| 229 | clear_screen() |
| 230 | meta_workflow(model, context_variables, False) |
| 231 | case 'exit': |
| 232 | console = Console() |
| 233 | logo_text = Text(GOODBYE_LOGO, justify="center") |
| 234 | console.print(Panel(logo_text, style="bold salmon1", expand=True)) |
| 235 | break |
| 236 | |
| 237 | |
| 238 | def user_mode(model: str, context_variables: dict, debug: bool = True): |
nothing calls this directly
no test coverage detected