mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Path in observation (#1216)
* create observation with the workspace path * rename the whole path whole_path
This commit is contained in:
parent
2bf34093b0
commit
fe3d4b129d
@ -36,10 +36,10 @@ class FileReadAction(ExecutableAction):
|
||||
action: str = ActionType.READ
|
||||
|
||||
async def run(self, controller) -> FileReadObservation:
|
||||
path = resolve_path(self.path)
|
||||
whole_path = resolve_path(self.path)
|
||||
self.start = max(self.start, 0)
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-8') as file:
|
||||
with open(whole_path, 'r', encoding='utf-8') as file:
|
||||
if self.end == -1:
|
||||
if self.start == 0:
|
||||
code_view = file.read()
|
||||
@ -56,7 +56,7 @@ class FileReadAction(ExecutableAction):
|
||||
code_view = ''.join(code_slice)
|
||||
except FileNotFoundError:
|
||||
raise FileNotFoundError(f'File not found: {self.path}')
|
||||
return FileReadObservation(path=path, content=code_view)
|
||||
return FileReadObservation(path=self.path, content=code_view)
|
||||
|
||||
@property
|
||||
def message(self) -> str:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user