.NET 8 SDK SQL Server OpenAI API Key (or Azure OpenAI endpoint, resource name and key)
-
Create a database in SQL Server. There are two EF contexts in the app that will share this db.
-
Update the connection strings in appsettings.json (secrets.json) in the BlazorGPT.Web directory
"ConnectionStrings:BlazorGptDB": "[your connection string]", "ConnectionStrings:UserDB": "[your connection string]",
-
Run the following commands from the src/BlazorGPT directory:
dotnet ef database update -s '..\BlazorGPT.Web\' --context BlazorGptDBContext
-
Run the following commands from the src/BlazorGPT.Web directory:
dotnet ef database update --context ApplicationDbContext
-
Update the OpenAI API Key and primary model in appsettings.json (secrets.json) in the src/BlazorGPT.Web directory For OpenAI:
"PipelineOptions:Model": "gpt-3.5-turbo", // or gpt-4 "OpenAIServiceOptions:ApiKey": "[your api key]]"
For Azure OpenAI:
"PipelineOptions:Model": "gpt-4", "OpenAIServiceOptions": { "ApiKey": "[your api key]", "DeploymentId": "[your deployment id]", // model deployment id "ResourceName": "[your resource name]]", "ProviderType": "Azure", "ApiVersion": "2023-03-15-preview" }
-
Run the application from the src/BlazorGPT.Web directory:
dotnet run
-
Open the application in a browser at http://localhost:5281/
-
Create a user account and login to the application