private async Task CreateNewChatProfile() { var picker = new SingleInputForm("Enter profile name", "", "Create"); var res = picker.ShowDialog(); if (res == DialogResult.OK && !string.IsNullOrWhiteSpace(picker.ResultString)) { await DbBotCollection.AddOrUpdateChatProfileById(BotAlphaName, new BotChatProfile { Name = picker.ResultString }); await DbBotCollection.SetActiveChatProfileById(BotAlphaName, picker.ResultString); await LoadChatProfiles(); } }
private async Task RenameChatProfile() { var picker = new SingleInputForm("Enter new profile name", "", "Rename"); var res = picker.ShowDialog(); if (res == DialogResult.OK && !string.IsNullOrWhiteSpace(picker.ResultString)) { if (string.IsNullOrWhiteSpace(cbxChatProfiles.Items.Cast <string>().FirstOrDefault(x => x.Equals(picker.ResultString, StringComparison.InvariantCultureIgnoreCase)))) { gbNeuralNodeConfiguration.Enabled = gbNeuralTree.Enabled = gbOtherConfigurations.Enabled = gbQuickLinks.Enabled = false; await DbContext.RenameCurrentChatProfile(picker.ResultString); await LoadChatProfiles(); gbNeuralNodeConfiguration.Enabled = gbNeuralTree.Enabled = gbOtherConfigurations.Enabled = gbQuickLinks.Enabled = true; } } }