Skip to content

Commit 9adbd7e

Browse files
committed
chore: improve locall env vars setup
fixes #8
1 parent d09cf39 commit 9adbd7e

File tree

8 files changed

+288
-832
lines changed

8 files changed

+288
-832
lines changed

.devcontainer/devcontainer.json

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:dev-20-bullseye",
33
"features": {
44
"ghcr.io/devcontainers-contrib/features/turborepo-npm:1": {},
5-
"ghcr.io/devcontainers-contrib/features/typescript:2": {},
6-
"ghcr.io/devcontainers/features/python:1": {
7-
"version": "3.11",
8-
"toolsToInstall": [
9-
"flake8",
10-
"black",
11-
"mypy",
12-
"poetry"
13-
]
14-
}
5+
"ghcr.io/azure/azure-dev/azd:latest": {},
6+
"ghcr.io/devcontainers/features/docker-in-docker:1": {
7+
"version": "20.10.23",
8+
"moby": "false",
9+
"dockerDashComposeVersion": "v2"
10+
},
11+
"ghcr.io/devcontainers/features/azure-cli:1": {
12+
"version": "latest",
13+
"installBicep": true
14+
},
15+
"ghcr.io/devcontainers/features/github-cli:1": {
16+
"version": "latest"
17+
},
18+
"ghcr.io/devcontainers-contrib/features/typescript:2": {}
1519
},
1620
"customizations": {
1721
"codespaces": {
@@ -23,24 +27,26 @@
2327
"extensions": [
2428
"ms-vscode.typescript-language-features",
2529
"esbenp.prettier-vscode",
26-
"ms-python.python",
27-
"ms-python.black-formatter",
28-
"ms-python.vscode-flake8",
29-
"ms-python.vscode-pylance"
30-
],
31-
"settings": {
32-
"python.formatting.provider": "black",
33-
"python.languageServer": "Pylance",
34-
"python.analysis.typeCheckingMode": "basic"
35-
}
30+
"ms-azuretools.vscode-bicep",
31+
"ms-azuretools.vscode-azurecontainerapps",
32+
"ms-azuretools.vscode-docker",
33+
"dbaeumer.vscode-eslint",
34+
"esbenp.prettier-vscode",
35+
"ms-azuretools.azure-dev",
36+
"GitHub.vscode-pull-request-github",
37+
"EditorConfig.EditorConfig",
38+
"GitHub.copilot"
39+
]
3640
}
3741
},
38-
"containerEnv": {
39-
"POETRY_VIRTUALENVS_CREATE": "false"
42+
"portsAttributes": {
43+
"3000": {
44+
"label": "Next.js",
45+
"onAutoForward": "notify"
46+
}
4047
},
4148
"forwardPorts": [
42-
3000,
43-
8000
49+
3000
4450
],
4551
"postCreateCommand": "npm install"
4652
}

.env

Lines changed: 0 additions & 15 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn-error.log*
2626

2727
# local env files
2828
.env*.local
29-
29+
.env
3030
# vercel
3131
.vercel
3232

@@ -35,4 +35,4 @@ yarn-error.log*
3535
next-env.d.ts
3636

3737
tool-output/
38-
.azure
38+
.azure

app/api/chat/engine/settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export const initSettings = async () => {
1616
console.log(`Using '${process.env.MODEL_PROVIDER}' model provider`);
1717

1818
// if provider is OpenAI, MODEL must be set
19-
if (process.env.MODEL_PROVIDER === 'openai' && process.env.OPENAI_API_TYPE !== 'azure' && !process.env.MODEL) {
19+
if (process.env.MODEL_PROVIDER === 'openai' && process.env.OPENAI_API_TYPE !== 'AzureOpenAI' && !process.env.MODEL) {
2020
throw new Error("'MODEL' env variable must be set.");
2121
}
2222

2323
// if provider is Azure OpenAI, AZURE_DEPLOYMENT_NAME must be set
24-
if (process.env.MODEL_PROVIDER === 'openai' && process.env.OPENAI_API_TYPE === 'azure' && !process.env.AZURE_DEPLOYMENT_NAME) {
24+
if (process.env.MODEL_PROVIDER === 'openai' && process.env.OPENAI_API_TYPE === 'AzureOpenAI' && !process.env.AZURE_DEPLOYMENT_NAME) {
2525
throw new Error("'AZURE_DEPLOYMENT_NAME' env variables must be set.");
2626
}
2727

@@ -34,7 +34,7 @@ export const initSettings = async () => {
3434
initOllama();
3535
break;
3636
case "openai":
37-
if (process.env.OPENAI_API_TYPE === "azure") {
37+
if (process.env.OPENAI_API_TYPE === "AzureOpenAI") {
3838
await initAzureOpenAI();
3939
} else {
4040
initOpenAI();

azure.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ services:
1616
continueOnError: false
1717
interactive: false
1818
run: npm run generate
19+
hooks:
20+
postprovision:
21+
windows:
22+
shell: pwsh
23+
run: azd env get-values > .env
24+
posix:
25+
shell: sh
26+
run: azd env get-values > .env

infra/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,4 @@ output LLM_MAX_TOKENS string = llamaIndexConfig.llm_max_tokens
262262
output TOP_K string = llamaIndexConfig.top_k
263263
output FILESERVER_URL_PREFIX string = llamaIndexConfig.fileserver_url_prefix
264264
output SYSTEM_PROMPT string = llamaIndexConfig.system_prompt
265+
output OPENAI_API_TYPE string = 'AzureOpenAI'

0 commit comments

Comments
 (0)