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
+11 -1
View File
@@ -16,6 +16,16 @@ export const removeDoubleNewlines = (input: string): string => {
return input;
};
export const getJSONBlock = (input: string): string => {
const jsonIndex = input.search('```json');
if(jsonIndex > -1) {
input = input.slice(jsonIndex + 8);
const endJsonIndex = consistency.search('```');
input = input.slice(0, endJsonIndex);
}
return input;
};
export const commitlintLLMConfigExists = async (): Promise<boolean> => {
let exists;
try {
@@ -44,4 +54,4 @@ export const getCommitlintLLMConfig =
content.toString()
) as CommitlintLLMConfig;
return commitLintLLMConfig;
};
};