Skip to content

Commit 18b1589

Browse files
author
Harmanpreet Kaur
committed
refactor: clean up code formatting and remove unnecessary comments
1 parent 60fff4a commit 18b1589

File tree

6 files changed

+18
-22
lines changed

6 files changed

+18
-22
lines changed

src/backend/common/database/cosmosdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ async def get_agent_messages(self, plan_id: str) -> List[AgentMessageData]:
495495

496496
async def add_team_agent(self, team_agent: CurrentTeamAgent) -> None:
497497
"""Add an agent message to the database."""
498-
await self.delete_team_agent(team_agent.team_id, team_agent.agent_name) # Ensure no duplicates
498+
await self.delete_team_agent(team_agent.team_id, team_agent.agent_name) # Ensure no duplicates
499499
await self.add_item(team_agent)
500500

501501
async def delete_team_agent(self, team_id: str, agent_name: str) -> None:

src/backend/common/models/messages_af.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class UserCurrentTeam(BaseDataModel):
112112
user_id: str
113113
team_id: str
114114

115+
115116
class CurrentTeamAgent(BaseDataModel):
116117
"""Represents the current agent of a user."""
117118
data_type: Literal[DataType.current_team_agent] = DataType.current_team_agent
@@ -123,7 +124,6 @@ class CurrentTeamAgent(BaseDataModel):
123124
agent_foundry_id: str
124125

125126

126-
127127
class Plan(BaseDataModel):
128128
"""Represents a plan containing multiple steps."""
129129
data_type: Literal[DataType.plan] = DataType.plan

src/backend/v4/api/router.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ async def process_request(
232232
authenticated_user = get_authenticated_user_details(request_headers=request.headers)
233233
user_id = authenticated_user["user_principal_id"]
234234
if not user_id:
235-
track_event_if_configured(
236-
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
237-
)
238-
raise HTTPException(status_code=400, detail="no user found")
235+
track_event_if_configured(
236+
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
237+
)
238+
raise HTTPException(status_code=400, detail="no user found")
239239
try:
240240
memory_store = await DatabaseFactory.get_database(user_id=user_id)
241241
user_current_team = await memory_store.get_current_team(user_id=user_id)
@@ -253,7 +253,7 @@ async def process_request(
253253
status_code=400,
254254
detail=f"Error retrieving team configuration: {e}",
255255
) from e
256-
256+
257257
if not await rai_success(input_task.description, team, memory_store):
258258
track_event_if_configured(
259259
"RAI failed",
@@ -268,7 +268,6 @@ async def process_request(
268268
detail="Request contains content that doesn't meet our safety guidelines, try again.",
269269
)
270270

271-
272271
if not input_task.session_id:
273272
input_task.session_id = str(uuid.uuid4())
274273
try:
@@ -705,10 +704,10 @@ async def upload_team_config(
705704
authenticated_user = get_authenticated_user_details(request_headers=request.headers)
706705
user_id = authenticated_user["user_principal_id"]
707706
if not user_id:
708-
track_event_if_configured(
709-
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
710-
)
711-
raise HTTPException(status_code=400, detail="no user found")
707+
track_event_if_configured(
708+
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
709+
)
710+
raise HTTPException(status_code=400, detail="no user found")
712711
try:
713712
memory_store = await DatabaseFactory.get_database(user_id=user_id)
714713

src/backend/v4/magentic_agents/common/lifecycle.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

33
import logging
4-
import secrets
5-
import string
64
from contextlib import AsyncExitStack
75
from typing import Any, Optional
86

src/backend/v4/magentic_agents/foundry_agent.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def _create_azure_search_enabled_client(self, chatClient=None) -> Optional
124124
"""
125125
if chatClient:
126126
return chatClient
127-
127+
128128
if not self.search:
129129
self.logger.error("Search configuration missing.")
130130
return None
@@ -229,10 +229,9 @@ async def _after_open(self) -> None:
229229
self.logger.info("Initializing agent in Foundry mode.")
230230
temp = 0.1
231231

232-
233232
try:
234-
chatClient= await self.get_database_team_agent()
235-
233+
chatClient = await self.get_database_team_agent()
234+
236235
if self._use_azure_search:
237236
# Azure Search mode (skip MCP + Code Interpreter due to incompatibility)
238237
self.logger.info(
@@ -272,7 +271,7 @@ async def _after_open(self) -> None:
272271
)
273272

274273
self.logger.info("Initialized ChatAgent '%s'", self.agent_name)
275-
if not chatClient: # Only save if we didn't load from DB
274+
if not chatClient: # Only save if we didn't load from DB
276275
await self.save_database_team_agent()
277276

278277
except Exception as ex:

src/backend/v4/orchestration/orchestration_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ async def init_orchestration(
7979
db_agent_id = await get_database_team_agent_id(
8080
memory_store, team_config, agent_name
8181
)
82-
agent_id = db_agent_id or generate_assistant_id()
82+
# agent_id = db_agent_id or generate_assistant_id()
8383
try:
8484
chat_client = AzureAIAgentClient(
8585
project_endpoint=config.AZURE_AI_PROJECT_ENDPOINT,
8686
model_deployment_name=team_config.deployment_name,
87-
# agent_id=agent_id,
87+
# agent_id=agent_id,
8888
agent_name=agent_name,
8989
async_credential=credential,
9090
)
@@ -312,7 +312,7 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
312312
final_output: str | None = None
313313

314314
self.logger.info("Starting workflow execution...")
315-
thread_id = f"task-{job_id}"
315+
# thread_id = f"task-{job_id}"
316316
async for event in workflow.run_stream(task_text):
317317
try:
318318
# Handle orchestrator messages (task assignments, coordination)

0 commit comments

Comments
 (0)