Skip to content

Commit 0fca73d

Browse files
committed
First commit for repo
0 parents  commit 0fca73d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2424
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "openai-chat-app-quickstart",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
4+
"forwardPorts": [50505],
5+
"features": {
6+
"ghcr.io/azure/azure-dev/azd:latest": {}
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-azuretools.azure-dev",
12+
"ms-azuretools.vscode-bicep",
13+
"ms-python.python",
14+
"GitHub.vscode-github-actions"
15+
]
16+
}
17+
},
18+
"postCreateCommand": "python3 -m pip install -r requirements-dev.txt && python3 -m pip install -e src",
19+
"remoteUser": "vscode",
20+
"hostRequirements": {
21+
"memory": "8gb"
22+
}
23+
}

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
AZURE_INFERENCE_ENDPOINT=https://<resource-name>.services.ai.azure.com/models
2+
AZURE_TENANT_ID=YOUR-TENANT-ID
3+
AZURE_INFERENCE_API_VERSION=2024-05-01-preview

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sh text eol=lf
2+
*.jsonlines text eol=lf

.github/CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns

.github/CONTRIBUTING.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributing to [project-title]
2+
3+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
4+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
6+
7+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
8+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
9+
provided by the bot. You will only need to do this once across all repos using our CLA.
10+
11+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13+
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
14+
15+
- [Code of Conduct](#coc)
16+
- [Issues and Bugs](#issue)
17+
- [Feature Requests](#feature)
18+
- [Submission Guidelines](#submit)
19+
20+
## <a name="coc"></a> Code of Conduct
21+
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
22+
23+
## <a name="issue"></a> Found an Issue?
24+
If you find a bug in the source code or a mistake in the documentation, you can help us by
25+
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
26+
[submit a Pull Request](#submit-pr) with a fix.
27+
28+
## <a name="feature"></a> Want a Feature?
29+
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
30+
Repository. If you would like to *implement* a new feature, please submit an issue with
31+
a proposal for your work first, to be sure that we can use it.
32+
33+
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
34+
35+
## <a name="submit"></a> Submission Guidelines
36+
37+
### <a name="submit-issue"></a> Submitting an Issue
38+
Before you submit an issue, search the archive, maybe your question was already answered.
39+
40+
If your issue appears to be a bug, and hasn't been reported, open a new issue.
41+
Help us to maximize the effort we can spend fixing issues and adding new
42+
features, by not reporting duplicate issues. Providing the following information will increase the
43+
chances of your issue being dealt with quickly:
44+
45+
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
46+
* **Version** - what version is affected (e.g. 0.1.2)
47+
* **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
48+
* **Browsers and Operating System** - is this a problem with all browsers?
49+
* **Reproduce the Error** - provide a live example or a unambiguous set of steps
50+
* **Related Issues** - has a similar issue been reported before?
51+
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
52+
causing the problem (line of code or commit)
53+
54+
You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new].
55+
56+
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
57+
Before you submit your Pull Request (PR) consider the following guidelines:
58+
59+
* Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR
60+
that relates to your submission. You don't want to duplicate effort.
61+
62+
* Make your changes in a new git fork:
63+
64+
* Commit your changes using a descriptive commit message
65+
* Push your fork to GitHub:
66+
* In GitHub, create a pull request
67+
* If we suggest changes then:
68+
* Make the required updates.
69+
* Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
70+
71+
```shell
72+
git rebase master -i
73+
git push -f
74+
```
75+
76+
That's it! Thank you for your contribution!

.github/ISSUE_TEMPLATE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--
2+
IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION
3+
-->
4+
> Please provide us with the following information:
5+
> ---------------------------------------------------------------
6+
7+
### This issue is for a: (mark with an `x`)
8+
```
9+
- [ ] bug report -> please search issues before submitting
10+
- [ ] feature request
11+
- [ ] documentation issue or request
12+
- [ ] regression (a behavior that used to work and stopped in a new release)
13+
```
14+
15+
### Minimal steps to reproduce
16+
>
17+
18+
### Any log messages given by the failure
19+
>
20+
21+
### Expected/desired behavior
22+
>
23+
24+
### OS and Version?
25+
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
26+
27+
### Versions
28+
>
29+
30+
### Mention any other details that might be useful
31+
32+
> ---------------------------------------------------------------
33+
> Thanks! We'll be in touch soon.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Purpose
2+
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->
3+
* ...
4+
5+
## Does this introduce a breaking change?
6+
<!-- Mark one with an "x". -->
7+
```
8+
[ ] Yes
9+
[ ] No
10+
```
11+
12+
## Pull Request Type
13+
What kind of change does this Pull Request introduce?
14+
15+
<!-- Please check the one that applies to this PR using "x". -->
16+
```
17+
[ ] Bugfix
18+
[ ] Feature
19+
[ ] Code style update (formatting, local variables)
20+
[ ] Refactoring (no functional changes, no api changes)
21+
[ ] Documentation content changes
22+
[ ] Other... Please describe:
23+
```
24+
25+
## How to Test
26+
* Get the code
27+
28+
```
29+
git clone [repo-address]
30+
cd [repo-name]
31+
git checkout [branch-name]
32+
npm install
33+
```
34+
35+
* Test the code
36+
<!-- Add steps to run the tests suite and/or manually test -->
37+
```
38+
```
39+
40+
## What to Check
41+
Verify that the following are valid
42+
* ...
43+
44+
## Other Information
45+
<!-- Add any other helpful information that may be needed here. -->

.github/dependabot.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
schedule:
11+
interval: monthly
12+
groups:
13+
github-actions:
14+
patterns:
15+
- "*"
16+
- package-ecosystem: "pip-compile" # See documentation for possible values
17+
directory: "/" # Location of package manifests
18+
schedule:
19+
interval: "weekly"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Validate bicep scripts
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**/*.bicep"
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- "**/*.bicep"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Build Bicep for linting
23+
uses: azure/CLI@v2
24+
with:
25+
inlineScript: |
26+
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
27+
az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout
28+
29+
- name: Run Microsoft Security DevOps Analysis
30+
uses: microsoft/security-devops-action@preview
31+
id: msdo
32+
continue-on-error: true
33+
with:
34+
tools: templateanalyzer
35+
36+
- name: Upload alerts to Security tab
37+
uses: github/codeql-action/upload-sarif@v3
38+
if: github.repository_owner == 'Azure-Samples'
39+
with:
40+
sarif_file: ${{ steps.msdo.outputs.sarifFile }}

.github/workflows/azure-dev.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy to Azure with azd
2+
on:
3+
workflow_dispatch:
4+
push:
5+
# Run when commits are pushed to mainline branch (main or master)
6+
# Set this to the mainline branch you are using
7+
branches:
8+
- main
9+
10+
# GitHub Actions workflow to deploy to Azure using azd
11+
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
12+
13+
# Set up permissions for deploying with secretless Azure federated credentials
14+
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
env:
23+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
24+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
25+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
26+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
27+
# project specific:
28+
SERVICE_ACA_RESOURCE_EXISTS: ${{ vars.SERVICE_ACA_RESOURCE_EXISTS }}
29+
DISABLE_KEY_BASED_AUTH: ${{ vars.DISABLE_KEY_BASED_AUTH }}
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Install azd
35+
uses: Azure/[email protected]
36+
37+
- name: Log in with Azure (Federated Credentials)
38+
if: ${{ env.AZURE_CLIENT_ID != '' }}
39+
run: |
40+
azd auth login `
41+
--client-id "$Env:AZURE_CLIENT_ID" `
42+
--federated-credential-provider "github" `
43+
--tenant-id "$Env:AZURE_TENANT_ID"
44+
shell: pwsh
45+
46+
- name: Log in with Azure (Client Credentials)
47+
if: ${{ env.AZURE_CREDENTIALS != '' }}
48+
run: |
49+
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
50+
Write-Host "::add-mask::$($info.clientSecret)"
51+
52+
azd auth login `
53+
--client-id "$($info.clientId)" `
54+
--client-secret "$($info.clientSecret)" `
55+
--tenant-id "$($info.tenantId)"
56+
shell: pwsh
57+
env:
58+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
59+
60+
- name: Provision Infrastructure
61+
run: |
62+
azd env set CREATE_ROLE_FOR_USER false --no-prompt
63+
azd provision --no-prompt
64+
env:
65+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
66+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
67+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
68+
69+
- name: Deploy Application
70+
run: azd deploy --no-prompt
71+
env:
72+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
73+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
74+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}

0 commit comments

Comments
 (0)