-
Notifications
You must be signed in to change notification settings - Fork 21
exit gracefully with large file #17
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,8 @@ async def fetch_file_content( | |
| if not source_path or not source_path.exists(): | ||
| return f"Invalid {owner} and {repo}. Check that the input is correct or try to fetch the repo from gh first." | ||
| lines = get_file(source_path, path) | ||
| if len(lines) > 1000: | ||
| return f"File {path} in {owner}/{repo} is too large to display ({len(lines)} lines). Please fetch specific lines using get_file_lines tool." | ||
|
||
| if not lines: | ||
| return f"Unable to find file {path} in {owner}/{repo}" | ||
| for i in range(len(lines)): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 1000 should be extracted as a named constant at the module level. This makes the limit configurable and self-documenting. Consider defining something like
MAX_FILE_LINES = 1000at the top of the file with the other constants.