From 0e4c5d96e3f5c529cbf84caf9a28d3474117841d Mon Sep 17 00:00:00 2001 From: seeker-jie Date: Thu, 8 Aug 2024 19:27:40 +0800 Subject: [PATCH] fix: fix swe agent command repeat --- metagpt/prompts/di/swe_agent.py | 2 ++ metagpt/tools/libs/terminal.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/metagpt/prompts/di/swe_agent.py b/metagpt/prompts/di/swe_agent.py index 7455cf30a..69c02de0c 100644 --- a/metagpt/prompts/di/swe_agent.py +++ b/metagpt/prompts/di/swe_agent.py @@ -224,6 +224,8 @@ IMPORTANT_TIPS = """ 14. If provided an issue link, you MUST go to the issue page using Browser tool to understand the issue before starting your fix. 15. When the edit fails, try to enlarge the starting line. + +16. Once again, and this is critical: YOU CAN ONLY ENTER ONE COMMAND AT A TIME. """ NEXT_STEP_TEMPLATE = f""" diff --git a/metagpt/tools/libs/terminal.py b/metagpt/tools/libs/terminal.py index 9bb6a09ec..b87e0c720 100644 --- a/metagpt/tools/libs/terminal.py +++ b/metagpt/tools/libs/terminal.py @@ -4,7 +4,7 @@ from asyncio import Queue from asyncio.subprocess import PIPE, STDOUT from typing import Optional -from metagpt.const import DEFAULT_WORKSPACE_ROOT, SWE_CMD_WORK_DIR, SWE_SETUP_PATH +from metagpt.const import SWE_CMD_WORK_DIR, SWE_SETUP_PATH from metagpt.logs import logger from metagpt.tools.tool_registry import register_tool from metagpt.utils.report import END_MARKER_VALUE, TerminalReporter @@ -159,7 +159,7 @@ class Bash(Terminal): self.start_flag = False async def start(self): - await self.run_command(f"cd {DEFAULT_WORKSPACE_ROOT}") + await self.run_command(f"cd {SWE_CMD_WORK_DIR}") await self.run_command(f"source {SWE_SETUP_PATH}") async def run(self, cmd) -> str: