Skip to content

Commit ebe2cf7

Browse files
committed
Merge branch 'dev' into kpczerwinski/secrt-1726-move-completion-backend
2 parents 69cb8a1 + 6588110 commit ebe2cf7

File tree

259 files changed

+11608
-3824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+11608
-3824
lines changed

.github/workflows/claude.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
with:
4545
fetch-depth: 1
4646

47+
- name: Free Disk Space (Ubuntu)
48+
uses: jlumbroso/[email protected]
49+
with:
50+
large-packages: false # slow
51+
docker-images: false # limited benefit
52+
4753
# Backend Python/Poetry setup (mirrors platform-backend-ci.yml)
4854
- name: Set up Python
4955
uses: actions/setup-python@v5

.github/workflows/platform-frontend-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- "autogpt_platform/frontend/**"
1313
merge_group:
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || '' }}
17+
cancel-in-progress: true
18+
1519
defaults:
1620
run:
1721
shell: bash

.github/workflows/platform-fullstack-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- "autogpt_platform/**"
1313
merge_group:
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || '' }}
17+
cancel-in-progress: true
18+
1519
defaults:
1620
run:
1721
shell: bash

autogpt_platform/backend/backend/blocks/agent.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
BlockType,
1212
get_block,
1313
)
14-
from backend.data.execution import ExecutionStatus, NodesInputMasks
14+
from backend.data.execution import ExecutionContext, ExecutionStatus, NodesInputMasks
1515
from backend.data.model import NodeExecutionStats, SchemaField
1616
from backend.util.json import validate_with_jsonschema
1717
from backend.util.retry import func_retry
@@ -72,9 +72,9 @@ async def run(
7272
input_data: Input,
7373
*,
7474
graph_exec_id: str,
75+
execution_context: ExecutionContext,
7576
**kwargs,
7677
) -> BlockOutput:
77-
7878
from backend.executor import utils as execution_utils
7979

8080
graph_exec = await execution_utils.add_graph_execution(
@@ -83,8 +83,9 @@ async def run(
8383
user_id=input_data.user_id,
8484
inputs=input_data.inputs,
8585
nodes_input_masks=input_data.nodes_input_masks,
86-
parent_graph_exec_id=graph_exec_id,
87-
is_sub_graph=True, # AgentExecutorBlock executions are always sub-graphs
86+
execution_context=execution_context.model_copy(
87+
update={"parent_execution_id": graph_exec_id},
88+
),
8889
)
8990

9091
logger = execution_utils.LogMetadata(

autogpt_platform/backend/backend/blocks/ai_image_customizer.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
from enum import Enum
23
from typing import Literal
34

@@ -19,14 +20,28 @@
1920
SchemaField,
2021
)
2122
from backend.integrations.providers import ProviderName
22-
from backend.util.file import MediaFileType
23+
from backend.util.file import MediaFileType, store_media_file
2324

2425

2526
class GeminiImageModel(str, Enum):
2627
NANO_BANANA = "google/nano-banana"
2728
NANO_BANANA_PRO = "google/nano-banana-pro"
2829

2930

31+
class AspectRatio(str, Enum):
32+
MATCH_INPUT_IMAGE = "match_input_image"
33+
ASPECT_1_1 = "1:1"
34+
ASPECT_2_3 = "2:3"
35+
ASPECT_3_2 = "3:2"
36+
ASPECT_3_4 = "3:4"
37+
ASPECT_4_3 = "4:3"
38+
ASPECT_4_5 = "4:5"
39+
ASPECT_5_4 = "5:4"
40+
ASPECT_9_16 = "9:16"
41+
ASPECT_16_9 = "16:9"
42+
ASPECT_21_9 = "21:9"
43+
44+
3045
class OutputFormat(str, Enum):
3146
JPG = "jpg"
3247
PNG = "png"
@@ -69,6 +84,11 @@ class Input(BlockSchemaInput):
6984
default=[],
7085
title="Input Images",
7186
)
87+
aspect_ratio: AspectRatio = SchemaField(
88+
description="Aspect ratio of the generated image",
89+
default=AspectRatio.MATCH_INPUT_IMAGE,
90+
title="Aspect Ratio",
91+
)
7292
output_format: OutputFormat = SchemaField(
7393
description="Format of the output image",
7494
default=OutputFormat.PNG,
@@ -92,6 +112,7 @@ def __init__(self):
92112
"prompt": "Make the scene more vibrant and colorful",
93113
"model": GeminiImageModel.NANO_BANANA,
94114
"images": [],
115+
"aspect_ratio": AspectRatio.MATCH_INPUT_IMAGE,
95116
"output_format": OutputFormat.JPG,
96117
"credentials": TEST_CREDENTIALS_INPUT,
97118
},
@@ -116,11 +137,25 @@ async def run(
116137
**kwargs,
117138
) -> BlockOutput:
118139
try:
140+
# Convert local file paths to Data URIs (base64) so Replicate can access them
141+
processed_images = await asyncio.gather(
142+
*(
143+
store_media_file(
144+
graph_exec_id=graph_exec_id,
145+
file=img,
146+
user_id=user_id,
147+
return_content=True,
148+
)
149+
for img in input_data.images
150+
)
151+
)
152+
119153
result = await self.run_model(
120154
api_key=credentials.api_key,
121155
model_name=input_data.model.value,
122156
prompt=input_data.prompt,
123-
images=input_data.images,
157+
images=processed_images,
158+
aspect_ratio=input_data.aspect_ratio.value,
124159
output_format=input_data.output_format.value,
125160
)
126161
yield "image_url", result
@@ -133,12 +168,14 @@ async def run_model(
133168
model_name: str,
134169
prompt: str,
135170
images: list[MediaFileType],
171+
aspect_ratio: str,
136172
output_format: str,
137173
) -> MediaFileType:
138174
client = ReplicateClient(api_token=api_key.get_secret_value())
139175

140176
input_params: dict = {
141177
"prompt": prompt,
178+
"aspect_ratio": aspect_ratio,
142179
"output_format": output_format,
143180
}
144181

0 commit comments

Comments
 (0)