diff --git a/ChatRPG/ChatRPG/Pages/Campaign.razor b/ChatRPG/ChatRPG/Pages/Campaign.razor index 7787f64..08f6dde 100644 --- a/ChatRPG/ChatRPG/Pages/Campaign.razor +++ b/ChatRPG/ChatRPG/Pages/Campaign.razor @@ -44,10 +44,13 @@ readonly List _conversation = new List(); private string _userInput = ""; - protected override async Task OnInitializedAsync() + protected override async Task OnAfterRenderAsync(bool firstRender) { - _shouldSave = Configuration.GetValue("SaveConversationsToFile"); - _scrollJsScript = await JsRuntime.InvokeAsync("import", "./js/scroll.js"); + if (firstRender) + { + _shouldSave = Configuration.GetValue("SaveConversationsToFile"); + _scrollJsScript = await JsRuntime.InvokeAsync("import", "./js/scroll.js"); + } } async Task EnterKeyHandler(KeyboardEventArgs e) diff --git a/ChatRPG/ChatRPG/appsettings.json b/ChatRPG/ChatRPG/appsettings.json index 8047ed5..a3464a5 100644 --- a/ChatRPG/ChatRPG/appsettings.json +++ b/ChatRPG/ChatRPG/appsettings.json @@ -9,5 +9,8 @@ } }, "AllowedHosts": "*", - "SaveConversationsToFile": true + "SaveConversationsToFile": true, + "ApiKeys": { + "OpenAI": "myOpenAiApiKey" + } }