Merge branch 'ntindle/secrt-1831-filter-out-graph-only-blocks-from-copilots-find_block' of https://github.com/Significant-Gravitas/AutoGPT into ntindle/secrt-1831-filter-out-graph-only-blocks-from-copilots-find_block

This commit is contained in:
Nicholas Tindle
2026-02-08 19:49:18 -06:00
2 changed files with 6 additions and 9 deletions

View File

@@ -19,11 +19,10 @@ logger = logging.getLogger(__name__)
_TARGET_RESULTS = 10
# Over-fetch to compensate for post-hoc filtering of graph-only blocks.
# ~16-17 blocks are currently excluded; 40 provides ample margin.
# 40 is 2x current removed; speed of query 10 vs 40 is minimial
_OVERFETCH_PAGE_SIZE = 40
# Block types that only work within graphs and cannot run standalone in CoPilot.
# NOTE: This does NOT affect the Builder UI which uses load_all_blocks() directly.
COPILOT_EXCLUDED_BLOCK_TYPES = {
BlockType.INPUT, # Graph interface definition - data enters via chat, not graph inputs
BlockType.OUTPUT, # Graph interface definition - data exits via chat, not graph outputs

View File

@@ -254,13 +254,11 @@ class BlockHandler(ContentHandler):
all_blocks = get_blocks()
# Filter out disabled blocks - they're not indexed
enabled_block_ids = []
for block_id, block_cls in all_blocks.items():
try:
if not block_cls().disabled:
enabled_block_ids.append(block_id)
except Exception as e:
logger.warning(f"Failed to instantiate block {block_id}: {e}")
enabled_block_ids = [
block_id
for block_id, block_cls in all_blocks.items()
if not block_cls().disabled
]
total_blocks = len(enabled_block_ids)
if total_blocks == 0: