update SWEAgent
This commit is contained in:
parent
e5808d1a90
commit
6fa0b1be95
@ -29,7 +29,8 @@ class SWEAgent(ToolCallAgent):
|
|||||||
async def think(self) -> bool:
|
async def think(self) -> bool:
|
||||||
"""Process current state and decide next action"""
|
"""Process current state and decide next action"""
|
||||||
# Update working directory
|
# Update working directory
|
||||||
self.working_dir = await self.bash.execute("pwd")
|
result = await self.bash.execute("pwd")
|
||||||
|
self.working_dir = result.output
|
||||||
self.next_step_prompt = self.next_step_prompt.format(
|
self.next_step_prompt = self.next_step_prompt.format(
|
||||||
current_dir=self.working_dir
|
current_dir=self.working_dir
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,7 @@ import os
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from app.exceptions import ToolError
|
from app.exceptions import ToolError
|
||||||
from app.tool.base import BaseTool, CLIResult, ToolResult
|
from app.tool.base import BaseTool, CLIResult
|
||||||
|
|
||||||
|
|
||||||
_BASH_DESCRIPTION = """Execute a bash command in the terminal.
|
_BASH_DESCRIPTION = """Execute a bash command in the terminal.
|
||||||
@ -57,7 +57,7 @@ class _BashSession:
|
|||||||
if not self._started:
|
if not self._started:
|
||||||
raise ToolError("Session has not started.")
|
raise ToolError("Session has not started.")
|
||||||
if self._process.returncode is not None:
|
if self._process.returncode is not None:
|
||||||
return ToolResult(
|
return CLIResult(
|
||||||
system="tool must be restarted",
|
system="tool must be restarted",
|
||||||
error=f"bash has exited with returncode {self._process.returncode}",
|
error=f"bash has exited with returncode {self._process.returncode}",
|
||||||
)
|
)
|
||||||
@ -140,7 +140,7 @@ class Bash(BaseTool):
|
|||||||
self._session = _BashSession()
|
self._session = _BashSession()
|
||||||
await self._session.start()
|
await self._session.start()
|
||||||
|
|
||||||
return ToolResult(system="tool has been restarted.")
|
return CLIResult(system="tool has been restarted.")
|
||||||
|
|
||||||
if self._session is None:
|
if self._session is None:
|
||||||
self._session = _BashSession()
|
self._session = _BashSession()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user