diff --git a/SecondBotEvents/Config/ChatGptConfig.cs b/SecondBotEvents/Config/ChatGptConfig.cs index 2e83a80..b0c8e0b 100644 --- a/SecondBotEvents/Config/ChatGptConfig.cs +++ b/SecondBotEvents/Config/ChatGptConfig.cs @@ -27,6 +27,12 @@ namespace SecondBotEvents.Config settings.Add("ChatHistoryTimeout"); settings.Add("ShowDebug"); settings.Add("Provider"); + settings.Add("CustomName"); + } + + public string GetCustomName() + { + return ReadSettingAsString("CustomName", ""); } public bool GetShowDebug() diff --git a/SecondBotEvents/Services/ChatGptService.cs b/SecondBotEvents/Services/ChatGptService.cs index a19e42e..d47c2cc 100644 --- a/SecondBotEvents/Services/ChatGptService.cs +++ b/SecondBotEvents/Services/ChatGptService.cs @@ -288,19 +288,24 @@ namespace SecondBotEvents.Services } // trim history List> history = chatHistoryAI[user]; + string yourname = GetClient().Self.FirstName; + if(myConfig.GetCustomName() != "") + { + yourname = myConfig.GetCustomName(); + } if (history.Count() == 0) { if (avatarchat == true) { - history.Add(new KeyValuePair("system", "You are " + GetClient().Self.FirstName + ", "+myConfig.GetChatPrompt()+", you are talking to " + name + ".")); + history.Add(new KeyValuePair("system", "You are " + yourname + ", "+myConfig.GetChatPrompt()+", you are talking to " + name + ".")); } else if (groupchat == true) { - history.Add(new KeyValuePair("system", "You are " + GetClient().Self.FirstName + ", "+myConfig.GetChatPrompt()+", you are talking to a group of people.")); + history.Add(new KeyValuePair("system", "You are " + yourname + ", "+myConfig.GetChatPrompt()+", you are talking to a group of people.")); } else { - history.Add(new KeyValuePair("system", "You are " + GetClient().Self.FirstName + ", "+myConfig.GetChatPrompt()+", you are talking to people in a public place.")); + history.Add(new KeyValuePair("system", "You are " + yourname + ", "+myConfig.GetChatPrompt()+", you are talking to people in a public place.")); } } history.Add(new KeyValuePair("user", "" + name + " says " + message));