Spaces:
Runtime error
Runtime error
Update utils/run_pipeline_and_save.py
Browse files- utils/run_pipeline_and_save.py +28 -20
utils/run_pipeline_and_save.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from agents import (
|
2 |
product_manager_agent,
|
3 |
project_manager_agent,
|
@@ -5,33 +7,39 @@ from agents import (
|
|
5 |
software_engineer_agent,
|
6 |
quality_assurance_agent,
|
7 |
)
|
8 |
-
import os
|
9 |
-
import json
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
-
def run_pipeline_and_save(prompt):
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
|
|
18 |
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
-
|
35 |
-
|
|
|
36 |
|
37 |
-
return
|
|
|
1 |
+
import os
|
2 |
+
import json
|
3 |
from agents import (
|
4 |
product_manager_agent,
|
5 |
project_manager_agent,
|
|
|
7 |
software_engineer_agent,
|
8 |
quality_assurance_agent,
|
9 |
)
|
|
|
|
|
10 |
|
11 |
+
OUTPUT_DIR = "output"
|
12 |
+
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
13 |
|
14 |
+
def run_pipeline_and_save(prompt: str):
|
15 |
+
chat_log = []
|
16 |
|
17 |
+
# Step 1: Product Manager
|
18 |
+
pm_output = product_manager_agent.run(prompt)
|
19 |
+
chat_log.append({"Product Manager": pm_output})
|
20 |
|
21 |
+
# Step 2: Project Manager
|
22 |
+
proj_output = project_manager_agent.run(pm_output)
|
23 |
+
chat_log.append({"Project Manager": proj_output})
|
24 |
|
25 |
+
# Step 3: Software Architect
|
26 |
+
arch_output = software_architect_agent.run(proj_output)
|
27 |
+
chat_log.append({"Software Architect": arch_output})
|
28 |
|
29 |
+
# Step 4: Software Engineer
|
30 |
+
eng_output = software_engineer_agent.run(arch_output)
|
31 |
+
chat_log.append({"Software Engineer": eng_output})
|
32 |
|
33 |
+
# Step 5: Quality Assurance
|
34 |
+
qa_output = quality_assurance_agent.run(eng_output)
|
35 |
+
chat_log.append({"Quality Assurance": qa_output})
|
36 |
|
37 |
+
# Save final UI output files
|
38 |
+
with open(os.path.join(OUTPUT_DIR, "index.html"), "w") as f:
|
39 |
+
f.write(eng_output)
|
40 |
|
41 |
+
# Save chat log
|
42 |
+
with open(os.path.join(OUTPUT_DIR, "agent_log.json"), "w") as f:
|
43 |
+
json.dump(chat_log, f, indent=2)
|
44 |
|
45 |
+
return chat_log, eng_output
|