Skip to content

Commit 4b1e62a

Browse files
committed
Refactor backend to use common package structure
Moved configuration, authentication, models, services, and utility modules from src/backend to src/backend/common for better organization and modularity. Updated all imports throughout the backend to reflect the new structure. Removed obsolete files including app_config.py, config_kernel.py, and several validation and test modules that are now redundant or replaced by the new structure.
1 parent 2c13a13 commit 4b1e62a

Some content is hidden

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

51 files changed

+144
-3025
lines changed

src/backend/app_kernel.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
from typing import Dict, List, Optional
1111

1212
# Semantic Kernel imports
13-
from app_config import config
13+
from common.config.app_config import config
1414
from auth.auth_utils import get_authenticated_user_details
1515
from azure.monitor.opentelemetry import configure_azure_monitor
16-
from config_kernel import Config
1716
from dateutil import parser
18-
from event_utils import track_event_if_configured
17+
from common.utils.event_utils import track_event_if_configured
1918

2019
# FastAPI imports
2120
from fastapi import FastAPI, HTTPException, Query, Request, UploadFile, File
@@ -24,7 +23,7 @@
2423

2524
# Local imports
2625
from middleware.health_check import HealthCheckMiddleware
27-
from models.messages_kernel import (
26+
from common.models.messages_kernel import (
2827
AgentMessage,
2928
AgentType,
3029
GeneratePlanRequest,
@@ -38,11 +37,11 @@
3837
UserLanguage,
3938
TeamConfiguration,
4039
)
41-
from services.json_service import JsonService
40+
from common.services.json_service import JsonService
4241

4342

4443
# Updated import for KernelArguments
45-
from utils_kernel import (
44+
from common.utils.utils_kernel import (
4645
initialize_runtime_and_context,
4746
rai_success,
4847
rai_validate_team_config,
@@ -81,7 +80,7 @@
8180
# Initialize the FastAPI app
8281
app = FastAPI()
8382

84-
frontend_url = Config.FRONTEND_SITE_NAME
83+
frontend_url = config.FRONTEND_SITE_NAME
8584

8685
# Add this near the top of your app.py, after initializing the app
8786
app.add_middleware(
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Services package
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from azure.ai.projects.aio import AIProjectClient
77
from azure.cosmos.aio import CosmosClient
8-
from helpers.azure_credential_utils import get_azure_credential
8+
from common.auth.azure_credential_utils import get_azure_credential
99
from dotenv import load_dotenv
1010
from semantic_kernel.kernel import Kernel
1111

@@ -159,7 +159,9 @@ def get_ai_project_client(self):
159159
)
160160

161161
endpoint = self.AZURE_AI_AGENT_ENDPOINT
162-
self._ai_project_client = AIProjectClient(endpoint=endpoint, credential=credential)
162+
self._ai_project_client = AIProjectClient(
163+
endpoint=endpoint, credential=credential
164+
)
163165

164166
return self._ai_project_client
165167
except Exception as exc:
File renamed without changes.

src/backend/services/json_service.py renamed to src/backend/common/services/json_service.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
from azure.identity import DefaultAzureCredential
1616
from azure.search.documents.indexes import SearchIndexClient
1717

18-
from models.messages_kernel import TeamConfiguration, TeamAgent, StartingTask
18+
from common.models.messages_kernel import (
19+
TeamConfiguration,
20+
TeamAgent,
21+
StartingTask,
22+
)
1923
from context.cosmos_memory_kernel import CosmosMemoryContext
20-
from helpers.azure_credential_utils import get_azure_credential
24+
from common.auth.azure_credential_utils import get_azure_credential
2125

2226

2327
class JsonService:

0 commit comments

Comments
 (0)