INNER CODE UNIT · JavaScript

genReviewPRPrompt

kxxt/chatgpt-action · prompt.js:1

function genReviewPRPrompt(title, body, diff) {
  const prompt = `Can you tell me the problems with the following pull request and describe your suggestions? 
  title: ${title}
  body: ${body}
  The following diff is the changes made in this PR.
  ${diff}`;
  return prompt;
}

function genReviewPRSplitedPrompt(title, body, diff, limit) {
  let splits = [];
  diff
    .split(/(diff --git .+\n)/g)
    .slice(1)
    .reduce((prev, cur, i) => {
      if (i % 2 == 1) {
        let dif = prev + cur;
        if (dif.length > limit) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…