From a09b9a5f8ee4418b5a2a3297c6e0021a122568e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 25 Mar 2023 18:57:12 +0000 Subject: [PATCH] [GPT-Codemaster] Progress on issue #5: Custom system messages --- .../Steps/Helpers/FollowNextStepExecutor.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/AiProgrammer/Solving/Steps/Helpers/FollowNextStepExecutor.cs b/AiProgrammer/Solving/Steps/Helpers/FollowNextStepExecutor.cs index f8b4944..484ca47 100644 --- a/AiProgrammer/Solving/Steps/Helpers/FollowNextStepExecutor.cs +++ b/AiProgrammer/Solving/Steps/Helpers/FollowNextStepExecutor.cs @@ -1,4 +1,4 @@ -using System.Text; +using System.Text; using AiProgrammer.AiInterface; using AiProgrammer.Solving.GithubIssue; @@ -9,6 +9,7 @@ public class FollowNextStepExecutor private readonly ICompletions _completions; private readonly IIssueDescriptionProvider _issueDescriptionProvider; private readonly ICurrentStepsHolder _currentStepsHolder; + private string _customSystemMessage; public FollowNextStepExecutor(ICompletions completions, IIssueDescriptionProvider issueDescriptionProvider, ICurrentStepsHolder currentStepsHolder) @@ -16,8 +17,14 @@ public FollowNextStepExecutor(ICompletions completions, IIssueDescriptionProvide _completions = completions; _issueDescriptionProvider = issueDescriptionProvider; _currentStepsHolder = currentStepsHolder; + _customSystemMessage = null; } + public void SetCustomSystemMessage(string customSystemMessage) + { + _customSystemMessage = customSystemMessage; + } + public async Task ExecuteStep(string contentDescription, string content, string currentStepDescription) { string stepContent = $"{contentDescription}:\n" + @@ -59,6 +66,11 @@ private string GetFullUserInput(string issueDescription, string stepInstructions private string GetSystemMessage() { + if (_customSystemMessage != null) + { + return _customSystemMessage; + } + return "You are an AI system that does programming tasks by reading the issue specification and modifying the existing code by " + "changing it or adding new code to resolve the user request. You minimize changes to the code and make sure not to modify " + "anything that the user has not requested. Do not remove classes, methods, or fields - only add or modify existing ones. " + @@ -104,4 +116,4 @@ private string GetStepsDescription() return stepsDescriptionBuilder.ToString(); } -} +} \ No newline at end of file