Skip to content
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

fix: max prompt length per model #33

Merged
merged 1 commit into from
Jul 24, 2023
Merged

fix: max prompt length per model #33

merged 1 commit into from
Jul 24, 2023

Conversation

mattzcarey
Copy link
Owner

@mattzcarey mattzcarey commented Jul 24, 2023

Fixes #31

@mattzcarey mattzcarey force-pushed the fix/max-prompt-length branch from 413afe4 to 09d2381 Compare July 24, 2023 11:19
@github-actions
Copy link
Contributor

LOGAF Level 4 - /home/runner/work/code-review-gpt/code-review-gpt/src/review/prompt/getMaxPromptLength.ts


LOGAF Level 2 - /home/runner/work/code-review-gpt/code-review-gpt/src/review/prompt/constructPrompt.ts

  1. The splitFileContentsIntoChunks function could be more efficient by using a while loop instead of a for loop. This would avoid unnecessary iterations.
const splitFileContentsIntoChunks = (fileContents: string, maxChunkSize: number): string[] => {
  const chunks = [];
  let position = 0;
  while (position < fileContents.length) {
    chunks.push(fileContents.slice(position, position + maxChunkSize));
    position += maxChunkSize;
  }
  return chunks;
};
  1. The constructPromptsArray function is quite large and does a lot of things. Consider breaking it down into smaller, more manageable functions.

LOGAF Level 3 - /home/runner/work/code-review-gpt/code-review-gpt/src/review/index.ts

  1. Consider adding type annotations to the ReviewArgs interface for better type safety. For example, if ci is always a boolean, specify it as such.
interface ReviewArgs {
  ci: boolean;
  _: (string | number)[];
  $0: string;
}
  1. The modelName variable is cast as a string without any checks. This could lead to runtime errors if yargs.model is not a string. Consider adding a check or handling for this scenario.

🔄🔧🔍


Powered by Code Review GPT

@mattzcarey mattzcarey merged commit fc45818 into main Jul 24, 2023
@mattzcarey mattzcarey deleted the fix/max-prompt-length branch July 24, 2023 11:27
This was referenced Aug 7, 2023
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.

Error in processing prompt Error: Request failed with status code 400
2 participants