Tachi67 commited on
Commit
35a0e84
·
1 Parent(s): ecfb8a0

Update PlanFileEditAtomicFlow.py

Browse files
Files changed (1) hide show
  1. PlanFileEditAtomicFlow.py +3 -12
PlanFileEditAtomicFlow.py CHANGED
@@ -30,12 +30,11 @@ class PlanFileEditAtomicFlow(AtomicFlow):
30
  try:
31
  with open(file_location, "w") as file:
32
  file.write(content)
33
- file_written_timestamp = os.path.getmtime(file_location)
34
 
35
- return True, f"Plan written to {file_location}", file_location, file_written_timestamp
36
 
37
  except Exception as e:
38
- return False, str(e), file_location, 0
39
 
40
  def _check_input(self, input_data: Dict[str, Any]):
41
  assert any(item in input_data for item in ["plan", "new_plan"]), "plan or new_plan is not passed to PlanFileEditAtomicFlow"
@@ -61,19 +60,11 @@ class PlanFileEditAtomicFlow(AtomicFlow):
61
  content_to_write, file_location_to_write = self._generate_input_to_writer(input_data)
62
 
63
  # ~~~ Calling the writer function ~~~
64
- result, plan_editor_output, temp_file_location, file_written_timestamp = self._write_plan_content_to_file(
65
  file_location_to_write, content_to_write)
66
 
67
- # ~~~ Opening up the file for the user to see ~~~
68
- if result:
69
- try:
70
- subprocess.run(["code", temp_file_location], timeout=10)
71
- except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
72
- webbrowser.open(temp_file_location)
73
-
74
  # ~~~ Generating return variables ~~~
75
  response = {}
76
  response["plan_editor_output"] = plan_editor_output
77
  response["temp_plan_file_location"] = temp_file_location
78
- response["temp_plan_file_written_timestamp"] = file_written_timestamp
79
  return response
 
30
  try:
31
  with open(file_location, "w") as file:
32
  file.write(content)
 
33
 
34
+ return True, f"Plan written to {file_location}", file_location
35
 
36
  except Exception as e:
37
+ return False, str(e), file_location
38
 
39
  def _check_input(self, input_data: Dict[str, Any]):
40
  assert any(item in input_data for item in ["plan", "new_plan"]), "plan or new_plan is not passed to PlanFileEditAtomicFlow"
 
60
  content_to_write, file_location_to_write = self._generate_input_to_writer(input_data)
61
 
62
  # ~~~ Calling the writer function ~~~
63
+ result, plan_editor_output, temp_file_location = self._write_plan_content_to_file(
64
  file_location_to_write, content_to_write)
65
 
 
 
 
 
 
 
 
66
  # ~~~ Generating return variables ~~~
67
  response = {}
68
  response["plan_editor_output"] = plan_editor_output
69
  response["temp_plan_file_location"] = temp_file_location
 
70
  return response