File tree Expand file tree Collapse file tree
.github/actions/auto-pr-description Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const fs = require('fs');
44const path = require ( 'path' ) ;
55
66// Configuration constants
7- const MAX_TOKENS_PER_REQUEST = 100000 ; // Conservative limit for Gemini 2.5 Flash
7+ const MAX_TOKENS_PER_REQUEST = 80000 ; // Conservative limit for Gemini 2.5 Flash
88const CHARS_PER_TOKEN = 4 ; // Rough estimation
99//const MAX_CHARS_PER_CHUNK = MAX_TOKENS_PER_REQUEST * CHARS_PER_TOKEN;
1010const MAX_CHUNKS = 3 ; // Limit to prevent excessive API calls
@@ -56,9 +56,9 @@ function chunkDiffByFiles(diffContent) {
5656
5757 for ( const line of lines ) {
5858 // Check if this is a new file header
59- console . error ( `Line is estimated at ${ estimateTokens ( line ) } tokens` ) ;
59+ // console.error(`Line is estimated at ${estimateTokens(line)} tokens`);
6060 tokenCount += estimateTokens ( line ) ;
61- console . error ( `Total tokens for this chunk is ${ tokenCount } ` ) ;
61+ // console.error(`Total tokens for this chunk is ${tokenCount}`);
6262 if ( line . startsWith ( 'diff --git' ) || line . startsWith ( '+++' ) || line . startsWith ( '---' ) ) {
6363 // If we have content and it's getting large, save current chunk
6464 if ( currentChunk && tokenCount > MAX_TOKENS_PER_REQUEST ) {
You can’t perform that action at this time.
0 commit comments