From 668d9e4734cc3b1b3b6fa5ba1760903bdabb85e7 Mon Sep 17 00:00:00 2001 From: Toastie Date: Mon, 15 Jul 2024 16:37:57 +1200 Subject: [PATCH] Found stuff that is wrong. --- .../Modules/Games/ChatterBot/ChatterbotService.cs | 8 ++++---- .../Games/ChatterBot/_common/OpenAiApiSession.cs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/EllieBot/Modules/Games/ChatterBot/ChatterbotService.cs b/src/EllieBot/Modules/Games/ChatterBot/ChatterbotService.cs index 2129d3b..66decdc 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/ChatterbotService.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/ChatterbotService.cs @@ -90,15 +90,15 @@ public class ChatterBotService : IExecOnMessage public string PrepareMessage(IUserMessage msg) { - var nadekoId = _client.CurrentUser.Id; - var normalMention = $"<@{nadekoId}> "; - var nickMention = $"<@!{nadekoId}> "; + var ellieId = _client.CurrentUser.Id; + var normalMention = $"<@{ellieId}> "; + var nickMention = $"<@!{ellieId}> "; string message; if (msg.Content.StartsWith(normalMention, StringComparison.InvariantCulture)) message = msg.Content[normalMention.Length..].Trim(); else if (msg.Content.StartsWith(nickMention, StringComparison.InvariantCulture)) message = msg.Content[nickMention.Length..].Trim(); - else if (msg.ReferencedMessage?.Author.Id == nadekoId) + else if (msg.ReferencedMessage?.Author.Id == ellieId) message = msg.Content; else return null; diff --git a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApiSession.cs b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApiSession.cs index 4511988..42afd22 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApiSession.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApiSession.cs @@ -15,7 +15,7 @@ public partial class OpenAiApiSession : IChatterBotSession private readonly int _maxHistory; private readonly int _maxTokens; private readonly int _minTokens; - private readonly string _nadekoUsername; + private readonly string _ellieUsername; private readonly GptEncoding _encoding; private List messages = new(); private readonly IHttpClientFactory _httpFactory; @@ -29,7 +29,7 @@ public partial class OpenAiApiSession : IChatterBotSession int maxTokens, int minTokens, string personality, - string nadekoUsername, + string ellieUsername, IHttpClientFactory factory) { if (string.IsNullOrWhiteSpace(url) || !Uri.TryCreate(url, UriKind.Absolute, out _)) @@ -45,7 +45,7 @@ public partial class OpenAiApiSession : IChatterBotSession _maxHistory = chatHistory; _maxTokens = maxTokens; _minTokens = minTokens; - _nadekoUsername = UsernameCleaner().Replace(nadekoUsername, ""); + _ellieUsername = UsernameCleaner().Replace(ellieUsername, ""); _encoding = GptEncoding.GetEncodingForModel("gpt-4o"); if (!string.IsNullOrWhiteSpace(personality)) { @@ -53,7 +53,7 @@ public partial class OpenAiApiSession : IChatterBotSession { Role = "system", Content = personality, - Name = _nadekoUsername + Name = _ellieUsername }); } } @@ -128,7 +128,7 @@ public partial class OpenAiApiSession : IChatterBotSession { Role = "assistant", Content = message, - Name = _nadekoUsername + Name = _ellieUsername }); return new ThinkResult()