diff options
author | Daniel Smith <daniel.smith@qt.io> | 2024-09-23 12:13:07 +0200 |
---|---|---|
committer | Daniel Smith <daniel.smith@qt.io> | 2024-10-07 09:51:15 +0000 |
commit | 7dca4b33aab7c4404de868ce09f3e10d1558445c (patch) | |
tree | f47b8751aa75a7f023abb94002cedb9de672bf10 | |
parent | afa73b351c9db210a575ff2c6ea7fcabf16437e2 (diff) |
Also includes a quick drive-by fix to include path correctly,
and a minor adjustment to the prompt.
Change-Id: I7aef56fba28544e9c79b65d0ab37603a9fc0529a
Reviewed-by: Daniel Smith <daniel.smith@qt.io>
-rw-r--r-- | api_review_GPT.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/api_review_GPT.js b/api_review_GPT.js index a6661c1..0eea5f0 100644 --- a/api_review_GPT.js +++ b/api_review_GPT.js @@ -7,6 +7,7 @@ const express = require('express'); const bodyParser = require('body-parser'); const safeJsonStringify = require('safe-json-stringify'); const https = require('https'); +const path = require('path'); const client = new OpenAIClient( "https://qttesteu.openai.azure.com/", @@ -23,7 +24,13 @@ const usage = { }; async function evaluateDiff(diff, commitMessage) { - const instructions = "Task: Classify the change in a public header file as significant to the behavior and usage of the API or not. Consider the content of the commit message in the evaluation. Additional qualifications: changes to 'private:' sections of public headers are not significant; whitespace-only and comment-only changes are not significant; additions of new and removal of old APIs are significant unless otherwise excluded."; + const instructions = "Task: Classify the change in a public header file as significant to the" + + " behavior and usage of the API or not. Consider the content of the commit message in" + + " the evaluation." + + " Additional qualifications: changes to 'private:' sections of public headers are not significant;" + + " whitespace-only and comment-only changes are not significant;" + + " additions of new and removal of old APIs are significant unless otherwise excluded." + + " Only include real additions, not user comments about additions."; try { const result = await client.getChatCompletions(deploymentId, [ @@ -131,6 +138,18 @@ function shouldExcludeFile(filePath, project) { return !inclusions.some(path => filePath.startsWith(path)); } + if (project.endsWith("qtwebengine")) { + const inclusions = ["src/core/api", "src/webenginewidgets/api", "src/webenginequick/api", + "src/pdfwidgets"]; + if (inclusions.some(path => filePath.startsWith(path))) { + return false; + } + // Inclusions without subfolders + const noSubdirsInclusions = ["src/pdf", "src/pdfquick"]; + const dirName = path.dirname(filePath); + return !noSubdirsInclusions.some(inclusion => dirName === inclusion); + } + return false; } |