Compare commits

...

2 Commits

Author SHA1 Message Date
seer-by-sentry[bot]
06a4e4defa fix(backend): Validate 'name' attribute when constructing AgentInput/OutputBlock 2025-10-25 10:46:39 +00:00
Bently
f4ba02f2f1 feat(blocks/revid): Add cost configs for revid video blocks (#11242)
Updated block costs in `backend/backend/data/block_cost_config.py`:
  - **AIShortformVideoCreatorBlock**: Updated from 50 credits to 307
  - **AIAdMakerVideoCreatorBlock**: Added cost of 714 credits
  - **AIScreenshotToVideoAdBlock**: Added cost of 612 credits

  ### Checklist 📋

  #### For code changes:
  - [x] I have clearly listed my changes in the PR description
  - [x] I have made a test plan
  - [x] I have tested my changes according to the test plan:
- [x] Verify AIShortformVideoCreatorBlock costs 307 credits when
executed
- [x] Verify AIAdMakerVideoCreatorBlock costs 714 credits when executed
- [x] Verify AIScreenshotToVideoAdBlock costs 612 credits when executed
2025-10-24 18:35:37 +01:00
2 changed files with 40 additions and 3 deletions

View File

@@ -1,7 +1,11 @@
from typing import Type
from backend.blocks.ai_music_generator import AIMusicGeneratorBlock
from backend.blocks.ai_shortform_video_block import AIShortformVideoCreatorBlock
from backend.blocks.ai_shortform_video_block import (
AIAdMakerVideoCreatorBlock,
AIScreenshotToVideoAdBlock,
AIShortformVideoCreatorBlock,
)
from backend.blocks.apollo.organization import SearchOrganizationsBlock
from backend.blocks.apollo.people import SearchPeopleBlock
from backend.blocks.apollo.person import GetPersonDetailBlock
@@ -323,7 +327,31 @@ BLOCK_COSTS: dict[Type[Block], list[BlockCost]] = {
],
AIShortformVideoCreatorBlock: [
BlockCost(
cost_amount=50,
cost_amount=307,
cost_filter={
"credentials": {
"id": revid_credentials.id,
"provider": revid_credentials.provider,
"type": revid_credentials.type,
}
},
)
],
AIAdMakerVideoCreatorBlock: [
BlockCost(
cost_amount=714,
cost_filter={
"credentials": {
"id": revid_credentials.id,
"provider": revid_credentials.provider,
"type": revid_credentials.type,
}
},
)
],
AIScreenshotToVideoAdBlock: [
BlockCost(
cost_amount=612,
cost_filter={
"credentials": {
"id": revid_credentials.id,

View File

@@ -264,7 +264,16 @@ class BaseGraph(BaseDbModel):
schema_fields: list[AgentInputBlock.Input | AgentOutputBlock.Input] = []
for type_class, input_default in props:
try:
schema_fields.append(type_class.model_construct(**input_default))
constructed_obj = type_class.model_construct(**input_default)
# Validate that the constructed object has required 'name' attribute
# model_construct() bypasses validation, so we need to check manually
if not hasattr(constructed_obj, "name") or constructed_obj.name is None:
logger.warning(
f"Skipping invalid {type_class.__name__} node: missing required 'name' field. "
f"Input data: {input_default}"
)
continue
schema_fields.append(constructed_obj)
except Exception as e:
logger.error(f"Invalid {type_class}: {input_default}, {e}")