Просмотр исходного кода

Path in observation (#1216)

* create observation with the workspace path

* rename the whole path whole_path
Engel Nyst 1 год назад
Родитель
Сommit
fe3d4b129d
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      opendevin/action/fileop.py

+ 3 - 3
opendevin/action/fileop.py

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