Merge pull request #563 from zhutao100/pr-readManyFilesLineLimit
Make the ReadManyFiles tool share the "DEFAULT_MAX_LINES_TEXT_FILE" limit across files.
This commit is contained in:
commit
38d9ee64ca
2 changed files with 6 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ import {
|
||||||
processSingleFileContent,
|
processSingleFileContent,
|
||||||
DEFAULT_ENCODING,
|
DEFAULT_ENCODING,
|
||||||
getSpecificMimeType,
|
getSpecificMimeType,
|
||||||
|
DEFAULT_MAX_LINES_TEXT_FILE,
|
||||||
} from '../utils/fileUtils.js';
|
} from '../utils/fileUtils.js';
|
||||||
import { PartListUnion } from '@google/genai';
|
import { PartListUnion } from '@google/genai';
|
||||||
import { Config, DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js';
|
import { Config, DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js';
|
||||||
|
|
@ -360,6 +361,8 @@ ${finalExclusionPatternsForDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedFiles = Array.from(filesToConsider).sort();
|
const sortedFiles = Array.from(filesToConsider).sort();
|
||||||
|
const file_line_limit =
|
||||||
|
DEFAULT_MAX_LINES_TEXT_FILE / Math.max(1, sortedFiles.length);
|
||||||
|
|
||||||
const fileProcessingPromises = sortedFiles.map(
|
const fileProcessingPromises = sortedFiles.map(
|
||||||
async (filePath): Promise<FileProcessingResult> => {
|
async (filePath): Promise<FileProcessingResult> => {
|
||||||
|
|
@ -398,6 +401,8 @@ ${finalExclusionPatternsForDescription
|
||||||
filePath,
|
filePath,
|
||||||
this.config.getTargetDir(),
|
this.config.getTargetDir(),
|
||||||
this.config.getFileSystemService(),
|
this.config.getFileSystemService(),
|
||||||
|
0,
|
||||||
|
file_line_limit,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fileReadResult.error) {
|
if (fileReadResult.error) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import mime from 'mime-types';
|
||||||
import { FileSystemService } from '../services/fileSystemService.js';
|
import { FileSystemService } from '../services/fileSystemService.js';
|
||||||
|
|
||||||
// Constants for text file processing
|
// Constants for text file processing
|
||||||
const DEFAULT_MAX_LINES_TEXT_FILE = 2000;
|
export const DEFAULT_MAX_LINES_TEXT_FILE = 2000;
|
||||||
const MAX_LINE_LENGTH_TEXT_FILE = 2000;
|
const MAX_LINE_LENGTH_TEXT_FILE = 2000;
|
||||||
|
|
||||||
// Default values for encoding and separator format
|
// Default values for encoding and separator format
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue