From 131b9b025949c3b303637b029526719c75069f08 Mon Sep 17 00:00:00 2001 From: dsellarsnr Date: Tue, 12 Mar 2024 13:01:19 -0400 Subject: [PATCH] NR-183484 Prevent suggestion of a code fix when the code is correct --- api_server/lib/grok/grok_client.js | 2 +- codestream-docker.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api_server/lib/grok/grok_client.js b/api_server/lib/grok/grok_client.js index 0e3adb24c..bf01eba66 100644 --- a/api_server/lib/grok/grok_client.js +++ b/api_server/lib/grok/grok_client.js @@ -230,7 +230,7 @@ class GrokClient { content += `Analyze this stack trace:\n\`\`\`\n${errorText}\n${stackTrace}\n\`\`\`\n`; if (code) { - content += `\nAnd fix the following code:\n\`\`\`\n${code}\n\`\`\``; + content += `\nAnd fix the following code, but only if a fix is truly needed:\n\`\`\`\n${code}\n\`\`\``; } const initialPrompt = [ diff --git a/codestream-docker.json b/codestream-docker.json index 2ccb7acff..950940454 100644 --- a/codestream-docker.json +++ b/codestream-docker.json @@ -167,7 +167,7 @@ "cloud": { "apiKey": "${INTEGRATIONS_NEWRELICGROK_CLOUD_API_KEY}", "apiUrl": "${INTEGRATIONS_NEWRELICGROK_CLOUD_API_URL}", - "prompt": "As a coding expert I am helpful and very knowledgeable about how to fix errors in code. I will be given errors, stack traces, and code snippets to analyze and fix. Only for the initial code and error analysis, if there is a beneficial code fix, I will output three sections: '**INTRO**', '**CODE_FIX**', and '**DESCRIPTION**'. If there is no code fix or there is just a custom exception thrown I will only output a '**DESCRIPTION**' section.\n\nAfter the first question about the code fix, every response after that should only have a '**DESCRIPTION**' section.\n\nThe output for each section should be markdown formatted.", + "prompt": "As a coding expert I am helpful and very knowledgeable about how to fix errors in code. I will be given errors, stack traces, and code snippets to analyze and fix. Only for the initial code and error analysis, I will output three sections: '**INTRO**', '**CODE_FIX**', and '**DESCRIPTION**'. The '**CODE_FIX**' section should contain the entire function, not just the updated lines, but it is OK for the '**CODE_FIX**' section to be completely omitted. I know that some errors are expected and are normal therefore do not need a code fix, in that case I will only output a '**DESCRIPTION**' section and omit the '**CODE_FIX**' and '**INTRO**' section.\n\nAfter the first question about the code fix, every response after that should only have a '**DESCRIPTION**' section.\n\nThe output for each section should be markdown formatted.", "model": "gpt-4" } },