Skip to content

Commit

Permalink
Reformat output folder (AI-Citizen#45)
Browse files Browse the repository at this point in the history
* Reformat output folder

* Remove comment code
  • Loading branch information
wwwwww1020 authored Sep 3, 2023
1 parent c30aa13 commit db1312e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ https://github.com/AI-Citizen/SolidGPT/assets/39673228/342ae7b3-7143-4bbc-a21d-c

- python3.8 or above
- (Optional)[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) - Required if you wish to utilize the SolidPortal
- [pnpm](https://pnpm.io/installation) - Install pnpm and making activating Corepack `corepack enable`
- [pnpm](https://pnpm.io/installation) - Install pnpm and making activating Corepack `corepack enable`. This is required for Lowdefy webapp to run.
- [Openai api key](https://openai.com/blog/openai-api)
- (Optional)[Notion](https://developers.notion.com/) - Create Notion api key and get the Notion page id which you want to use as the output AI content
- (Optional)[Notion](https://developers.notion.com/) - Create Notion api key and get the Notion page id which you want to use as the output AI content.

## **Quick Setup**
```sh
Expand Down Expand Up @@ -57,18 +57,18 @@ pip3 install -r requirements.txt #installing the env
include the brainstorming, write product requirement, write high level design, create kanban.
```sh
cd quickstart
python3 creategraph.py
python3 creategraph.py system
python3 quickstart.py system
```

**webapp dev workflow**
-include the brainstorming, write product requirement, write high level design, create kanban, generate app code(beta test), run web app.
```sh
cd quickstart
python3 creategraph.py
python3 creategraph.py webapp
python3 quickstart.py webapp
```
>Default output path is SolidGPT/localstorage/workspace/out/
>Default output path is SolidGPT/localstorage/workspace/out/<time - e.g. 202009011234>
## **Start Your Own Graph**
0. (Optional) Customize your own agent and skill [(learn more)](https://github.com/AI-Citizen/SolidGPT/blob/main/docs/customagentskill.md)
1. Create a graph using Solid Portal. [(learn more)](https://github.com/AI-Citizen/SolidGPT/blob/main/docs/solidportal.md). You can also create a graph json file by code. Please check `quickstart/creategraph.py`
Expand Down
4 changes: 3 additions & 1 deletion localstorage/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ embedding/originalresources/*
!embedding/originalresources/Placeholder.md

customizedskilldefinition/*.json
!customizedskilldefinition/WriteSystemDesign.json
!customizedskilldefinition/WriteSystemDesign.json

workspace/config/*
23 changes: 17 additions & 6 deletions quickstart/creategraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def generate_node_run_app(node_id: str, input_ids: list[int], output_ids: list[i
skill.init_config(
[
{
"param_path": os.path.join(LOCAL_STORAGE_OUTPUT_DIR , f"{input_ids[0]}/Write_YAML_Result_3"), # Manually input the generate node page output path
"loading_method": "SkillInputLoadingMethod.LOAD_FROM_STRING",
"param_path": "", # Manually input the generate node page output path
"loading_method": "SkillInputLoadingMethod.LOAD_FROM_OUTPUT_ID",
"load_from_output_id": input_ids[0]
},
],
Expand All @@ -134,7 +134,6 @@ def run_system_dev_graph():
manual_review_result=True))
app.add_node(generate_node_custom_system_design("1", input_ids=[0], output_ids=[1], manual_review_result=True))
app.add_node(generate_node_kanban("2", input_ids=[1], output_ids=[2], manual_review_result=True))
app.init_node_dependencies()
app.save_data(os.path.join(LOCAL_STORAGE_DIR, "workspace", "config", "system_config_data.json"))

def run_webapp_dev_graph():
Expand All @@ -149,9 +148,21 @@ def run_webapp_dev_graph():
app.add_node(generate_node_kanban("2", input_ids=[1], output_ids=[2], manual_review_result=True))
app.add_node(generate_node_page("3", input_ids=[2], output_ids=[3]))
app.add_node(generate_node_run_app("4", input_ids=[3], output_ids=[4]))
app.init_node_dependencies()
app.save_data(os.path.join(LOCAL_STORAGE_DIR, "workspace", "config", "webapp_config_data.json"))

def main():
# Check if the correct number of arguments are provided
if len(sys.argv) <2 or sys.argv[1] not in ["system", "webapp"]: # Adjust this number based on the number of arguments you expect
logging.info("Usage: python3 creategraph.py system (or webapp)")
sys.exit(1)
param = sys.argv[1]
if param == "system":
run_system_dev_graph()
elif param == "webapp":
run_webapp_dev_graph()
else:
logging.warn("Usage: python3 creategraph.py system (or webapp)")
sys.exit(1)

if __name__ == "__main__":
run_system_dev_graph()
run_webapp_dev_graph()
main()
13 changes: 4 additions & 9 deletions solidgpt/src/workgraph/workgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ def __init__(self, output_directory_path_override: str = ""):
self.output_map = {}
self.output_id_to_node_map = {}

self.output_directory_path = LOCAL_STORAGE_OUTPUT_DIR
self.output_directory_path = os.path.join(LOCAL_STORAGE_OUTPUT_DIR, time.strftime("%Y%m%d%H%M%S"))
if output_directory_path_override:
self.output_directory_path = os.path.abspath(output_directory_path_override)

if not os.path.exists(self.output_directory_path):
# Create the output folder
os.makedirs(self.output_directory_path)
print(f"Directory '{self.output_directory_path}' created.")
else:
pass
return

def add_node(self, node: WorkNode):
Expand Down Expand Up @@ -90,7 +83,7 @@ def init_node_dependencies(self):
return

def execute(self):
print("Executing SolidGPT...")
logging.info("Executing SolidGPT...")
first_nodes = []
for node in self.nodes:
if len(node.output_id_dependencies) == 0:
Expand All @@ -101,6 +94,8 @@ def execute(self):

for node in first_nodes:
self.__execute_node(node)
logging.info(f"SolidGPT execution completed. All results are saved in {self.output_directory_path}")


def __execute_node(self, node: WorkNode):
if node.can_execute():
Expand Down

0 comments on commit db1312e

Please sign in to comment.