Skip to content

Commit a434d54

Browse files
committed
docs for ai-poc
1 parent 2a10da7 commit a434d54

File tree

1 file changed

+61
-4
lines changed

1 file changed

+61
-4
lines changed

src/ai-poc/ai-poc-readme.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Introduction
1+
## Introduction 🛎️
22
### Workflow
33
#### Project 1: Pull Request Suggestion
44
- Workflow UML for demo
@@ -12,14 +12,14 @@
1212
- Workflow UML for development
1313
![iamge](images/all-metadata-dev.png)
1414

15-
## Instruction
15+
## Instruction 📐
1616
### Generate OPEN AI Credentials
1717
1. Log in [Azure Portal](https://portal.azure.com/#@adobe.onmicrosoft.com/resource/subscriptions/144eeab3-93ab-462c-9ed5-8ba04c159339/resourceGroups/ioevents-nonprod/providers/Microsoft.CognitiveServices/accounts/ioevents-openai-test/overview) with Adobe account
1818
2. Click "Explore azure AI foundry portal"
1919
![image](images/1.2.png)
2020
3. Click "Create new deployment" -> "From base models"
2121
![image](images/1.3.png)
22-
4. Select a model (recomment gpt4.1)
22+
4. Select a model (recomment gpt4.1, but we can try gpt5 as well 🤩)
2323
5. Click "Confirm"
2424
![image](images/1.4.png)
2525
6. Edit the Deployment Name and Deploy
@@ -40,7 +40,8 @@
4040
![image](images/2.3.png)
4141
4. Click "personal Access Tokens" -> "Tokens(classic)" -> "Generate new token"
4242
![image](images/2.4.png)
43-
5. To run the program on local machine, run `export GITHUB_TOKEN="<replace with your token>"`
43+
5. Grant at least read and write access to the token
44+
6. To run the program on local machine, run `export GITHUB_TOKEN="<replace with your token>"`
4445
> 💡Note: Github Token is only used for Github API call in local development. Without an github token in REST API header, Github will limit the read access for 60 requests/hour, and no edit aceess allowed.
4546
4647
### Store Scretes in Git Repo
@@ -50,4 +51,60 @@
5051
3. Click "New Repository Secrete" to add secreates / Click one Secreate's name to overwrite secreate
5152
![image](images/3.3.png)
5253

54+
## Run the Program 💻
55+
### Local Environment
56+
#### PR suggestion
57+
1. Set up the local environment:
58+
- Github Token: run `export GITHUB_TOKEN="<replace with your token>"`
59+
- Azure Open AI endpoint: run `export export AZURE_OPENAI_ENDPOINT="<replace with you azure endpoint>"`
60+
- Azure Open AI API key: run `export export AZURE_OPENAI_API_KEY="<replace with you azure API key>"`
61+
- File Path: run `export FILE_NAME="all_pages_content.txt"` (this is because both workflow shares ai-scripts.js, so need to differentiate file name to avoid duplication of code)
62+
2. Download dependencies
63+
- run `npm install`, or `yarn install` if npm doesn't work
64+
3. Run scripts one by one following deploy.yml
65+
- run `node src/pr-scripts.js`
66+
- run `node src/ai-scripts.js`
67+
- run `node src/review-scripts.js`
68+
4. Checkout the target Pull Request, the AI suggestion should be there
5369

70+
#### AI metadata for all pages
71+
1. Set up the local environment:
72+
- Github Token: run `export GITHUB_TOKEN="<replace with your token>"`
73+
- Azure Open AI endpoint: run `export export AZURE_OPENAI_ENDPOINT="<replace with you azure endpoint>"`
74+
- Azure Open AI API key: run `export export AZURE_OPENAI_API_KEY="<replace with you azure API key>"`
75+
- Pull Request id: run `export PR_ID="<replace with pr id>"`
76+
- File Path: run `export FILE_NAME="pr_content.txt"` (this is because both workflow shares ai-scripts.js, so need to differentiate file name to avoid duplication of code)
77+
2. Download dependencies
78+
- run `npm install`, or `yarn install` if npm doesn't work
79+
3. Run scripts one by one following test/pull-request.yml
80+
- run `node src/fetch-pages-scripts.js`
81+
- run `node src/ai-scripts.js`
82+
- run `node src/create-pr-scripts.js`
83+
4. Checkout the git repo, the new created PR should be opened
84+
85+
### Github Action
86+
#### PR suggestion
87+
1. Set up secretes in github repo
88+
- AZURE_OPENAI_ENDPOINT
89+
- Azure_OPENAI_API_KEY
90+
- (no need for github token, github action will provide one for itself)
91+
2. Create a pull request targeting to main branch with markdown changes in src/pages
92+
3. To run the program again, just close and repoen the pull request
93+
94+
#### AI metadata for all pages
95+
1. Set up secretes in github rep
96+
- AZURE_OPENAI_ENDPOINT
97+
- Azure_OPENAI_API_KEY
98+
- (no need for github token, github action will provide one for itself)
99+
2. deploy the main branch in github action
100+
101+
## Further Development Note ✏️
102+
- The markdown files with components are skipped for now, need to update them if we find a way to get raw information inside the components
103+
- The github repo related variables (owner, repo, ref ...) are hard coded, need to be updated for production
104+
- The PR suggestion workflow is defined in test-pull-request.yml, and the AI metadata for all pages is defined in deploy.yml. They may need to be seperated.
105+
- AI metadata for all pages workflow will create a PR targeting to main branch, which will trigger pr suggestion workflow. Pr suggestion may not appear everytime since the AI prompt requested "minimum amount of necessary change", we may need to refine the prompt to fix it? Another way is to add another condition to PR suggestion: "if the PR is created by github bot, then skip this workflow".
106+
107+
108+
> For any other questions, please feel free to reach out to me 🌽
109+
[School Email]([email protected]): actively checking before Nov 2025 (if no response in 2 hours, either in exam 📝 or in game raid 🎮)
110+
[Personal Email]([email protected]): checking daily

0 commit comments

Comments
 (0)