-
Notifications
You must be signed in to change notification settings - Fork 11
Testing workflow execution. DO NOT MERGE. #4
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
Conversation
Added custom prompt support.
…models Forced JSON mode on all models that support it.
} | ||
|
||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string { | ||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails, customPrompts: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The customPrompts
parameter is added to the function signature but is not used within the function. Ensure that it is utilized appropriately or remove it if unnecessary.
const customPrompts = core.getMultilineInput("custom_prompts") | ||
.map(customPrompt => `- ${customPrompt}`) | ||
.join("\n") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a missing semicolon at the end of the statement. In JavaScript, it's recommended to use semicolons to avoid automatic semicolon insertion issues.
.github/workflows/code_review.yml
Outdated
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
OPENAI_API_MODEL: "gpt-4-1106-preview" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the OPENAI_API_MODEL
value gpt-4-1106-preview
is a valid and existing model identifier. If this is a test value, it should be replaced with the correct model identifier before merging.
Added debug output.
Got rid of useless debug output and made output token count configurable.
], | ||
}); | ||
|
||
const res = response.choices[0].message?.content?.trim() || "{}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly accessing properties of response.choices[0].message?.content
without checking if response.choices[0]
and response.choices[0].message
exist could lead to a runtime error if they are undefined.
|
||
console.log(`Trimmed Response: ${res}`); | ||
|
||
return JSON.parse(res).reviews; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using JSON.parse
without a try-catch block can throw a SyntaxError
if res
is not valid JSON. Consider adding error handling for parsing.
No description provided.