feat(ai): Ignore diffs longer than 2000 characters to improve performance

This commit is contained in:
Will Hohyon Ryu 2024-03-07 19:01:18 -08:00
commit 871e421ec8

View file

@ -66,6 +66,9 @@ async function analyzeCode(
for (const file of parsedDiff) { for (const file of parsedDiff) {
if (file.to === "/dev/null") continue; // Ignore deleted files if (file.to === "/dev/null") continue; // Ignore deleted files
for (const chunk of file.chunks) { for (const chunk of file.chunks) {
// Ignore diffs longer than 2000 characters
if (chunk.content.length > 2000) continue;
const prompt = createPrompt(file, chunk, prDetails); const prompt = createPrompt(file, chunk, prDetails);
const aiResponse = await getAIResponse(prompt); const aiResponse = await getAIResponse(prompt);
if (aiResponse) { if (aiResponse) {