Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GPT-Codemaster] Fixes issue #5: Custom system messages #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions AiProgrammer/Solving/Steps/Helpers/FollowNextStepExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text;
using System.Text;
using AiProgrammer.AiInterface;
using AiProgrammer.Solving.GithubIssue;

Expand All @@ -9,15 +9,22 @@ 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)
{
_completions = completions;
_issueDescriptionProvider = issueDescriptionProvider;
_currentStepsHolder = currentStepsHolder;
_customSystemMessage = null;
}

public void SetCustomSystemMessage(string customSystemMessage)
{
_customSystemMessage = customSystemMessage;
}

public async Task<string> ExecuteStep(string contentDescription, string content, string currentStepDescription)
{
string stepContent = $"{contentDescription}:\n" +
Expand Down Expand Up @@ -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. " +
Expand Down Expand Up @@ -104,4 +116,4 @@ private string GetStepsDescription()

return stepsDescriptionBuilder.ToString();
}
}
}