Bug (commitling) Parse JSON blocks from return response (#297)

This commit is contained in:
Jack Lukic
2024-03-03 06:23:44 -05:00
committed by GitHub
parent c9b45492a5
commit ec699c48bf
2 changed files with 15 additions and 1 deletions
+4
View File
@@ -61,6 +61,10 @@ export const configureCommitlintIntegration = async (force = false) => {
// Cleanup the consistency answer. Sometimes 'gpt-3.5-turbo' sends rule's back.
prompts.forEach((prompt) => (consistency = consistency.replace(prompt, '')));
// sometimes consistency is preceded by explanatory text like "Here is your JSON:"
consistency = utils.getJSONBlock(consistency);
// ... remaining might be extra set of "\n"
consistency = utils.removeDoubleNewlines(consistency);