Skip to content

Commit ca93460

Browse files
committed
Set default values for TeamConfiguration fields
Updated rai_validate_team_config to initialize TeamConfiguration with default values and generated UUIDs. Also added deployment_name to TeamService creation from JSON data, ensuring the field is set even if missing.
1 parent b70adb0 commit ca93460

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/backend/common/utils/utils_af.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
"""Utility functions for agent_framework-based integration and agent management."""
22

3-
from http import client
43
import logging
5-
import secrets
6-
import string
7-
from typing import Optional # <-- Add this import
8-
9-
from tomlkit import (
10-
string as toml_string,
11-
) # <-- If you need tomlkit.string elsewhere, alias it
12-
4+
import uuid
135
from common.config.app_config import config
146

157
from common.database.database_base import DatabaseBase
@@ -206,7 +198,23 @@ async def rai_validate_team_config(
206198
combined = " ".join(text_content).strip()
207199
if not combined:
208200
return False, "Team configuration contains no readable text content."
209-
team_config = TeamConfiguration(**team_config_json)
201+
202+
team_config = TeamConfiguration(
203+
id=str(uuid.uuid4()),
204+
session_id=str(uuid.uuid4()),
205+
team_id=str(uuid.uuid4()),
206+
name="Uploaded Team",
207+
status="active",
208+
created=str(uuid.uuid4()),
209+
created_by=str(uuid.uuid4()),
210+
deployment_name="",
211+
agents=[],
212+
description="",
213+
logo="",
214+
plan="",
215+
starting_tasks=[],
216+
user_id=str(uuid.uuid4()),
217+
)
210218
if not await rai_success(combined, team_config, memory_store):
211219
return (
212220
False,

src/backend/v4/common/services/team_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ async def validate_and_parse_team_config(
103103
team_id=unique_team_id, # Use generated GUID
104104
name=json_data["name"],
105105
status=json_data["status"],
106+
deployment_name=json_data.get("deployment_name", ""),
106107
created=current_timestamp, # Use generated timestamp
107108
created_by=user_id, # Use user_id who uploaded the config
108109
agents=agents,

0 commit comments

Comments
 (0)