diff --git a/src/Ghosts.Api/Infrastructure/Animations/AnimationDefinitions/Chat/ChatClient.cs b/src/Ghosts.Api/Infrastructure/Animations/AnimationDefinitions/Chat/ChatClient.cs index b4d9797f..68067fc5 100644 --- a/src/Ghosts.Api/Infrastructure/Animations/AnimationDefinitions/Chat/ChatClient.cs +++ b/src/Ghosts.Api/Infrastructure/Animations/AnimationDefinitions/Chat/ChatClient.cs @@ -10,6 +10,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; +using Ghosts.Api; using ghosts.api.Hubs; using ghosts.api.Infrastructure.Animations.AnimationDefinitions.Chat.Mattermost; using ghosts.api.Infrastructure.ContentServices; @@ -444,6 +445,12 @@ private async Task StepEx(Random random, Guid NpcId, string username, string pas { _log.Trace($"Managing {username}..."); + if (username.Contains("admin")) + { + _log.Trace($"Skipping user {username}..."); + return; + } + try { await this.Login(username, password); @@ -518,7 +525,7 @@ private async Task StepEx(Random random, Guid NpcId, string username, string pas } } - var feelings = this._configuration.Prompts.GetRandom(random); + var subPrompts = this._configuration.Prompts.GetRandom(random); _log.Trace($"{username} looking at posts..."); if (random.Next(0, 100) > 50) @@ -541,12 +548,13 @@ private async Task StepEx(Random random, Guid NpcId, string username, string pas } } - var history = channelHistory.Where(x => x.ChannelId == randomChannelToPostTo && x.UserId != me.Username).MaxBy(x => x.Created); - var historyString = history is { Message.Length: >= 100 } ? history.Message[..100] : history?.Message; - - var prompt = $"Write my update to the chat system that {feelings}"; + var history = channelHistory.Where(x => x.ChannelId == randomChannelToPostTo && x.UserName != me.Username).MaxBy(x => x.Created); + //var historyString = history is { Message.Length: >= 100 } ? history.Message[..100] : history?.Message; + var historyString = history.Message; + + var prompt = $"Write my update to the chat system that {subPrompts}"; var respondingTo = string.Empty; - if (random.Next(0, 99) > 50 && !string.IsNullOrEmpty(historyString) && history.UserId != me.Id) + if (random.Next(0, 99) < Program.ApplicationSettings.AnimatorSettings.Animations.Chat.PercentReplyVsNew && !string.IsNullOrEmpty(historyString) && history.UserId != me.Id) { prompt = $"How do I respond to this? {historyString}"; @@ -554,11 +562,18 @@ private async Task StepEx(Random random, Guid NpcId, string username, string pas } var message = await this._formatterService.ExecuteQuery(prompt); - message = message.Clean(this._configuration.Replacements, random); + if (string.IsNullOrEmpty(message)) + { + _log.Trace($"Empty message for {me.Username} {prompt}. Continuing.."); + return; + } + if (!string.IsNullOrEmpty(respondingTo)) { + var f = $"{historyString} | {respondingTo} | {message}"; message = $"> {historyString.Replace(">", "")}{Environment.NewLine}{Environment.NewLine}@{respondingTo} {message}"; + _log.Trace($"{historyString} | {respondingTo} | {message}{Environment.NewLine}{f}"); } if (message.ShouldSend(this._configuration.Drops)) diff --git a/src/Ghosts.Api/Infrastructure/ApplicationSettings.cs b/src/Ghosts.Api/Infrastructure/ApplicationSettings.cs index f5511c14..4f410220 100644 --- a/src/Ghosts.Api/Infrastructure/ApplicationSettings.cs +++ b/src/Ghosts.Api/Infrastructure/ApplicationSettings.cs @@ -81,6 +81,7 @@ public class ChatSettings public int TurnLength { get; set; } public int MaximumSteps { get; set; } public bool IsSendingTimelinesToGhostsApi { get; set; } + public int PercentReplyVsNew { get; set; } public string PostUrl { get; set; } public ContentEngineSettings ContentEngine { get; set; } } diff --git a/src/Ghosts.Api/appsettings.json b/src/Ghosts.Api/appsettings.json index e32ed885..78adb9f9 100755 --- a/src/Ghosts.Api/appsettings.json +++ b/src/Ghosts.Api/appsettings.json @@ -85,6 +85,7 @@ "MaximumSteps": 300, "TurnLength": 9000, "IsSendingTimelinesToGhostsApi": false, + "PercentReplyVsNew": 40, "PostUrl": "http://localhost:8065", "ContentEngine": { "Source": "ollama", diff --git a/src/Ghosts.Api/config/chat.json b/src/Ghosts.Api/config/chat.json index 44e2bbf3..ce20b50c 100644 --- a/src/Ghosts.Api/config/chat.json +++ b/src/Ghosts.Api/config/chat.json @@ -5,8 +5,33 @@ "adminPassword": "scotty@1", "defaultUserPassword": "scotty@1", "agentsPerBatch": 10 - } , + }, "replacements": [], - "drops": ["As an AI"], - "prompts": [] + "drops": [ + "As an AI", + "super secret", + "secret chat" + ], + "prompts": [ + "portrays me as a fearless leader in battle", + "emphasizes my strategic brilliance in combat", + "depicts me as a master tactician", + "highlights my unyielding courage under fire", + "shows my exceptional ability to lead troops", + "underscores my unwavering discipline and resolve", + "paints me as a heroic figure on the battlefield", + "reflects my deep knowledge of military tactics", + "demonstrates my unparalleled battlefield awareness", + "conveys my ability to inspire soldiers", + "illustrates my remarkable physical fitness and endurance", + "captures my determination to achieve mission objectives", + "sheds light on my extensive experience in military operations", + "showcases my impressive marksmanship skills", + "reveals my proficiency in handling complex equipment", + "accentuates my commanding presence", + "presents me as a decisive and effective commander", + "underscores my quick decision-making under pressure", + "highlights my ability to execute flawless maneuvers", + "portrays me as a symbol of strength and leadership" + ] } diff --git a/src/Ghosts.Api/ghosts.api.csproj b/src/Ghosts.Api/ghosts.api.csproj index 8adeaf09..2b07b962 100644 --- a/src/Ghosts.Api/ghosts.api.csproj +++ b/src/Ghosts.Api/ghosts.api.csproj @@ -5,7 +5,7 @@ ghosts.api 8.0.0.0 - 8.1.0.0 + 8.1.1.0 GHOSTS Development Team for CERT > Software Engineering Institute > Carnegie Mellon University Carnegie Mellon University