mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-17 18:21:46 -05:00
fix: address review comments
- Remove redundant inline comment on text_only param - Simplify file filtering logic per review suggestion
This commit is contained in:
@@ -454,15 +454,15 @@ class ClaudeCodeBlock(Block):
|
||||
else:
|
||||
new_conversation_history = turn_entry
|
||||
|
||||
# Extract files created/modified during this run and store to workspace
|
||||
# Include binary files (images, PDFs, etc.) - they'll be stored via
|
||||
# store_media_file which handles virus scanning and workspace storage
|
||||
# Extract files created/modified during this run and store to workspace.
|
||||
# Binary files (images, PDFs, etc.) are stored via store_media_file
|
||||
# which handles virus scanning and workspace storage.
|
||||
sandbox_files = await extract_and_store_sandbox_files(
|
||||
sandbox=sandbox,
|
||||
working_directory=working_directory,
|
||||
execution_context=execution_context,
|
||||
since_timestamp=start_timestamp,
|
||||
text_only=False, # Extract both text and binary files
|
||||
text_only=False,
|
||||
)
|
||||
|
||||
return (
|
||||
|
||||
@@ -78,7 +78,6 @@ TEXT_EXTENSIONS = {
|
||||
}
|
||||
|
||||
# Binary file extensions we explicitly support extracting
|
||||
# These are common output formats that users expect to retrieve
|
||||
BINARY_EXTENSIONS = {
|
||||
# Images
|
||||
".png",
|
||||
@@ -202,15 +201,13 @@ async def extract_sandbox_files(
|
||||
file_path_lower.endswith(ext.lower()) for ext in BINARY_EXTENSIONS
|
||||
)
|
||||
|
||||
# Determine if we should extract this file
|
||||
if text_only:
|
||||
# Only extract text files
|
||||
if not is_text:
|
||||
continue
|
||||
else:
|
||||
# Extract text files and supported binary files
|
||||
if not is_text and not is_binary:
|
||||
continue
|
||||
# Skip files with unrecognized extensions
|
||||
if not is_text and not is_binary:
|
||||
continue
|
||||
|
||||
# In text_only mode, skip binary files
|
||||
if text_only and not is_text:
|
||||
continue
|
||||
|
||||
try:
|
||||
# For binary files, check size before reading to prevent OOM
|
||||
@@ -240,7 +237,6 @@ async def extract_sandbox_files(
|
||||
)
|
||||
continue
|
||||
|
||||
# Read file content as bytes
|
||||
content = await sandbox.files.read(file_path, format="bytes")
|
||||
if isinstance(content, str):
|
||||
content = content.encode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user