Found stuff that is wrong.

This commit is contained in:
Toastie (DCS Team) 2024-07-15 16:37:57 +12:00
parent 151146378b
commit 668d9e4734
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 9 additions and 9 deletions

View file

@ -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;

View file

@ -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<OpenAiApiMessage> 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()