Skip to content

Conversation

lukehollenback
Copy link
Owner

No description provided.

}

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails, customPrompts: string): string {
Copy link

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")

Copy link

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.

with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_MODEL: "gpt-4-1106-preview"
Copy link

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.

],
});

const res = response.choices[0].message?.content?.trim() || "{}";
Copy link

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;
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant