Tachi67 commited on
Commit
8d743fd
·
1 Parent(s): f194c58

Upload 8 files

Browse files
Files changed (3) hide show
  1. PlanWriterFlow.py +6 -6
  2. PlanWriterFlow.yaml +1 -1
  3. run_planwriter.py +3 -1
PlanWriterFlow.py CHANGED
@@ -17,11 +17,11 @@ class PlanWriterFlow(ContentWriterFlow):
17
  command = output_payload["command"]
18
  if command == "finish":
19
  # ~~~ fetch temp file location, plan content, memory file (of upper level flow e.g. ExtLib) from flow state
20
- keys_to_fetch_from_state = ["temp_plan_file_location", "plan", "plan_file_location"]
21
  fetched_state = self._fetch_state_attributes_by_keys(keys=keys_to_fetch_from_state)
22
  temp_plan_file_location = fetched_state["temp_plan_file_location"]
23
  plan_content = fetched_state["plan"]
24
- plan_file_location = fetched_state["plan_file_location"]
25
 
26
  # ~~~ delete the temp plan file ~~~
27
  if os.path.exists(temp_plan_file_location):
@@ -35,7 +35,7 @@ class PlanWriterFlow(ContentWriterFlow):
35
  return {
36
  "EARLY_EXIT": True,
37
  "plan": plan_content,
38
- "summary": "PlanWriter: " + output_payload["command_args"]["summary"],
39
  "status": "finished"
40
  }
41
  elif command == "manual_finish":
@@ -49,13 +49,13 @@ class PlanWriterFlow(ContentWriterFlow):
49
  return {
50
  "EARLY_EXIT": True,
51
  "plan": "no plan was generated",
52
- "summary": "PlanWriter: PlanWriter was terminated explicitly by the user, process is unfinished",
53
  "status": "unfinished"
54
  }
55
  elif command == "write_plan":
56
- keys_to_fetch_from_state = ["plan_file_location"]
57
  fetched_state = self._fetch_state_attributes_by_keys(keys=keys_to_fetch_from_state)
58
- plan_file_location = fetched_state["plan_file_location"]
59
  output_payload["command_args"]["plan_file_location"] = plan_file_location
60
  return output_payload
61
  else:
 
17
  command = output_payload["command"]
18
  if command == "finish":
19
  # ~~~ fetch temp file location, plan content, memory file (of upper level flow e.g. ExtLib) from flow state
20
+ keys_to_fetch_from_state = ["temp_plan_file_location", "plan", "memory_files"]
21
  fetched_state = self._fetch_state_attributes_by_keys(keys=keys_to_fetch_from_state)
22
  temp_plan_file_location = fetched_state["temp_plan_file_location"]
23
  plan_content = fetched_state["plan"]
24
+ plan_file_location = fetched_state["memory_files"]["plan"]
25
 
26
  # ~~~ delete the temp plan file ~~~
27
  if os.path.exists(temp_plan_file_location):
 
35
  return {
36
  "EARLY_EXIT": True,
37
  "plan": plan_content,
38
+ "summary": "ExtendLibrary/PlanWriter: " + output_payload["command_args"]["summary"],
39
  "status": "finished"
40
  }
41
  elif command == "manual_finish":
 
49
  return {
50
  "EARLY_EXIT": True,
51
  "plan": "no plan was generated",
52
+ "summary": "ExtendLibrary/PlanWriter: PlanWriter was terminated explicitly by the user, process is unfinished",
53
  "status": "unfinished"
54
  }
55
  elif command == "write_plan":
56
+ keys_to_fetch_from_state = ["memory_files"]
57
  fetched_state = self._fetch_state_attributes_by_keys(keys=keys_to_fetch_from_state)
58
+ plan_file_location = fetched_state["memory_files"]["plan"]
59
  output_payload["command_args"]["plan_file_location"] = plan_file_location
60
  return output_payload
61
  else:
PlanWriterFlow.yaml CHANGED
@@ -5,7 +5,7 @@ _target_: Tachi67.PlanWriterFlowModule.PlanWriterFlow.instantiate_from_default_c
5
 
6
  input_interface:
7
  - "goal"
8
- - "plan_file_location"
9
 
10
  output_interface:
11
  - "plan"
 
5
 
6
  input_interface:
7
  - "goal"
8
+ - "memory_files"
9
 
10
  output_interface:
11
  - "plan"
run_planwriter.py CHANGED
@@ -50,9 +50,11 @@ if __name__ == "__main__":
50
  with open(plan_file_location, 'w') as file:
51
  pass
52
 
 
 
53
  input_data = {
54
  "goal": "create a function that adds two numbers and returns the result",
55
- "plan_file_location": plan_file_location
56
  }
57
  input_message = InputMessage.build(
58
  data_dict=input_data,
 
50
  with open(plan_file_location, 'w') as file:
51
  pass
52
 
53
+ mem_files = {"plan": plan_file_location}
54
+
55
  input_data = {
56
  "goal": "create a function that adds two numbers and returns the result",
57
+ "memory_files": mem_files
58
  }
59
  input_message = InputMessage.build(
60
  data_dict=input_data,