Skip to content

Commit 6cadc7d

Browse files
authored
feat: bump ags version, minor fixes (#6603)
<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> Update autogenstudio version. <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number Closes #6580 <!-- For example: "Closes #1234" --> ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed.
1 parent 955f4f9 commit 6cadc7d

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

python/packages/autogen-studio/autogenstudio/database/db_manager.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@
1414

1515

1616
class CustomJSONEncoder(json.JSONEncoder):
17-
def default(self, obj):
18-
if hasattr(obj, "get_secret_value") and callable(obj.get_secret_value):
19-
return obj.get_secret_value()
20-
return super().default(obj)
17+
def default(self, o):
18+
if hasattr(o, "get_secret_value") and callable(o.get_secret_value):
19+
return o.get_secret_value()
20+
# Handle datetime objects
21+
if isinstance(o, datetime):
22+
return o.isoformat()
23+
# Handle Enum objects
24+
import enum
25+
26+
if isinstance(o, enum.Enum):
27+
return o.value
28+
return super().default(o)
2129

2230

2331
class DatabaseManager:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION = "0.4.2"
1+
VERSION = "0.4.2.2"
22
__version__ = VERSION
33
APP_NAME = "autogenstudio"

python/packages/autogen-studio/autogenstudio/web/managers/connection.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import asyncio
22
import logging
3+
import trace
34
import traceback
4-
from datetime import datetime, timezone
5+
from datetime import date, datetime, time, timezone
56
from typing import Any, Callable, Dict, Optional, Sequence, Union
67

78
from autogen_agentchat.base import TaskResult
@@ -87,12 +88,12 @@ async def start_stream(
8788
"""Start streaming task execution with proper run management"""
8889
if run_id not in self._connections or run_id in self._closed_connections:
8990
raise ValueError(f"No active connection for run {run_id}")
90-
9191
with RunContext.populate_context(run_id=run_id):
9292
team_manager = TeamManager()
9393
cancellation_token = CancellationToken()
9494
self._cancellation_tokens[run_id] = cancellation_token
9595
final_result = None
96+
env_vars = None # Ensure env_vars is always defined
9697

9798
try:
9899
# Update run with task and status
@@ -276,14 +277,15 @@ async def disconnect(self, run_id: int) -> None:
276277
self._input_responses.pop(run_id, None)
277278

278279
def _convert_images_in_dict(self, obj: Any) -> Any:
279-
"""Recursively find and convert Image objects in dictionaries and lists"""
280+
"""Recursively find and convert Image and datetime objects in dictionaries and lists"""
280281
if isinstance(obj, dict):
281282
return {k: self._convert_images_in_dict(v) for k, v in obj.items()}
282283
elif isinstance(obj, list):
283284
return [self._convert_images_in_dict(item) for item in obj]
284-
elif isinstance(obj, AGImage): # Assuming you've imported AGImage
285-
# Convert the Image object to a serializable format
285+
elif isinstance(obj, AGImage):
286286
return {"type": "image", "url": f"data:image/png;base64,{obj.to_base64()}", "alt": "Image"}
287+
elif isinstance(obj, (datetime, date, time)):
288+
return obj.isoformat()
287289
else:
288290
return obj
289291

@@ -306,6 +308,7 @@ async def _send_message(self, run_id: int, message: dict) -> None:
306308
logger.warning(f"WebSocket disconnected while sending message for run {run_id}")
307309
await self.disconnect(run_id)
308310
except Exception as e:
311+
traceback.print_exc()
309312
logger.error(f"Error sending message for run {run_id}: {e}, {message}")
310313
# Don't try to send error message here to avoid potential recursive loop
311314
await self._update_run_status(run_id, RunStatus.ERROR, str(e))

python/packages/autogen-studio/autogenstudio/web/routes/ws.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async def run_websocket(
7676

7777
logger.info(f"WebSocket connection established for run {run_id}")
7878

79+
raw_message = None # Initialize to avoid possibly unbound variable
7980
while True:
8081
try:
8182
raw_message = await websocket.receive_text()

python/packages/autogen-studio/frontend/src/components/sidebar.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ const navigation: INavItem[] = [
4848
icon: GalleryHorizontalEnd,
4949
breadcrumbs: [{ name: "Gallery", href: "/gallery", current: true }],
5050
},
51-
{
52-
name: "Labs",
53-
href: "/labs",
54-
icon: FlaskConical,
55-
breadcrumbs: [{ name: "Labs", href: "/labs", current: true }],
56-
},
51+
// {
52+
// name: "Labs",
53+
// href: "/labs",
54+
// icon: FlaskConical,
55+
// breadcrumbs: [{ name: "Labs", href: "/labs", current: true }],
56+
// },
5757
{
5858
name: "Deploy",
5959
href: "/deploy",

python/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)