Skip to content

Commit b35c72e

Browse files
authored
Add instructions for configuring .NET Aspire (#48058)
* Add instructions for configuring .NET Aspire
1 parent 4c79c28 commit b35c72e

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

docs/ai/quickstarts/includes/ai-templates-github-models.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,60 @@ To authenticate to GitHub models from your code, you'll need to [create a GitHub
8989
9090
## Configure the app
9191
92-
The **AI Chat Web App** app is almost ready to go as soon as it's created. However, you need to configure the app to use the personal access token you set up for GitHub Models. By default, the app template searches for this value in the project's local .NET user secrets. You can manage user secrets using either the Visual Studio UI or the .NET CLI.
92+
The **AI Chat Web App** is almost ready to go as soon as it's created. However, you need to configure the app to use the personal access token you set up for GitHub Models. By default, the app template searches for this value in the project's local .NET user secrets. You can manage user secrets using either the Visual Studio UI or the .NET CLI.
9393
94-
# [Visual Studio](#tab/configure-visual-studio)
94+
> [!NOTE]
95+
> If you enabled .NET Aspire for your app, skip to the [.NET Aspire configuration](#net-aspire-configuration) section.
96+
97+
## [Visual Studio](#tab/configure-visual-studio)
9598
96-
1. In Visual Studio, right-click on your project in the Solution Explorer and select **Manage User Secrets**. This opens a `secrets.json` file where you can store your API keys without them being tracked in source control.
99+
1. Right-click on your project in the Solution Explorer and select **Manage User Secrets**. This opens a `secrets.json` file where you can store your API keys without them being tracked in source control.
97100
98101
2. Add the following key and value:
99102
100103
```json
101104
{
102-
"GitHubModels:Token": "<your-personal-access-token>"
105+
"GitHubModels:Token": "<your-gh-models-access-token>"
103106
}
104107
```
105108
106-
# [.NET CLI](#tab/configure-dotnet-cli)
109+
## [.NET CLI](#tab/configure-dotnet-cli)
107110
108-
```dotnetcli
109-
dotnet user-secrets set GitHubModels:Token <your-personal-access-token>
110-
```
111+
1. Open a terminal window set to the root of your project.
112+
113+
1. Run the `dotnet user-secrets set` command to set the user secret:
114+
115+
```dotnetcli
116+
dotnet user-secrets set GitHubModels:Token <your-gh-models-access-token>
117+
```
118+
119+
---
120+
121+
### .NET Aspire configuration
122+
123+
To use the **AI Chat Web App** template with .NET Aspire orchestration, add the following configurations:
124+
125+
#### [Visual Studio](#tab/configure-visual-studio-aspire)
126+
127+
1. Right-click on your `*.AppHost` project in the Solution Explorer and select **Manage User Secrets**. This opens a `secrets.json` file where you can store your API keys without them being tracked in source control.
128+
129+
2. Add the following key and value:
130+
131+
```json
132+
{
133+
"ConnectionStrings:openai": "Endpoint=https://models.inference.ai.azure.com;Key=<your-gh-models-access-token>"
134+
}
135+
```
136+
137+
#### [.NET CLI](#tab/configure-dotnet-cli-aspire)
138+
139+
1. Open a terminal window set to the root of your `*.AppHost` project.
140+
141+
1. Run the `dotnet user-secrets set` command to set the user secret:
142+
143+
```dotnetcli
144+
dotnet user-secrets set ConnectionStrings:openai "Endpoint=https://models.inference.ai.azure.com;Key=<your-gh-models-access-token>"
145+
```
111146
112147
---
113148

0 commit comments

Comments
 (0)