Path in observation (#1216)

* create observation with the workspace path

* rename the whole path whole_path
This commit is contained in:
Engel Nyst 2024-04-18 21:06:51 +02:00 committed by GitHub
parent 2bf34093b0
commit fe3d4b129d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: