Skip to content

Commit 6541bd5

Browse files
committed
fix merge conflicts
2 parents 9af904e + 1daea22 commit 6541bd5

39 files changed

Lines changed: 2211 additions & 100 deletions

NEW_ENDPOINTS_SUMMARY.md

Whitespace-only changes.

TEAM_CONFIG_UPLOAD_README.md

Whitespace-only changes.

infra/main.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,10 @@ module containerApp 'br/public:avm/res/app/container-app:0.14.2' = if (container
10341034
name: 'AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME'
10351035
value: aiFoundryAiServicesModelDeployment.name
10361036
}
1037+
{
1038+
name: 'APP_ENV'
1039+
value: 'Prod'
1040+
}
10371041
]
10381042
}
10391043
]
@@ -1087,6 +1091,7 @@ module webSite 'br/public:avm/res/web/site:0.15.1' = if (webSiteEnabled) {
10871091
WEBSITES_CONTAINER_START_TIME_LIMIT: '1800' // 30 minutes, adjust as needed
10881092
BACKEND_API_URL: 'https://${containerApp.outputs.fqdn}'
10891093
AUTH_ENABLED: 'false'
1094+
APP_ENV: 'Prod'
10901095
}
10911096
}
10921097
}

src/backend/.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o
1616
APPLICATIONINSIGHTS_CONNECTION_STRING=
1717
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME=gpt-4o
1818
AZURE_AI_AGENT_ENDPOINT=
19+
APP_ENV="dev"
1920

2021
BACKEND_API_URL=http://localhost:8000
2122
FRONTEND_SITE_NAME=http://127.0.0.1:3000

src/backend/app_config.py

Lines changed: 20 additions & 21 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 azure.identity import DefaultAzureCredential
8+
from helpers.azure_credential_utils import get_azure_credential
99
from dotenv import load_dotenv
1010
from semantic_kernel.kernel import Kernel
1111

@@ -106,23 +106,6 @@ def _get_bool(self, name: str) -> bool:
106106
"""
107107
return name in os.environ and os.environ[name].lower() in ["true", "1"]
108108

109-
def get_azure_credentials(self):
110-
"""Get Azure credentials using DefaultAzureCredential.
111-
112-
Returns:
113-
DefaultAzureCredential instance for Azure authentication
114-
"""
115-
# Cache the credentials object
116-
if self._azure_credentials is not None:
117-
return self._azure_credentials
118-
119-
try:
120-
self._azure_credentials = DefaultAzureCredential()
121-
return self._azure_credentials
122-
except Exception as exc:
123-
logging.warning("Failed to create DefaultAzureCredential: %s", exc)
124-
return None
125-
126109
def get_cosmos_database_client(self):
127110
"""Get a Cosmos DB client for the configured database.
128111
@@ -132,7 +115,7 @@ def get_cosmos_database_client(self):
132115
try:
133116
if self._cosmos_client is None:
134117
self._cosmos_client = CosmosClient(
135-
self.COSMOSDB_ENDPOINT, credential=self.get_azure_credentials()
118+
self.COSMOSDB_ENDPOINT, credential=get_azure_credential()
136119
)
137120

138121
if self._cosmos_database is None:
@@ -169,10 +152,10 @@ def get_ai_project_client(self):
169152
return self._ai_project_client
170153

171154
try:
172-
credential = self.get_azure_credentials()
155+
credential = get_azure_credential()
173156
if credential is None:
174157
raise RuntimeError(
175-
"Unable to acquire Azure credentials; ensure DefaultAzureCredential is configured"
158+
"Unable to acquire Azure credentials; ensure Managed Identity is configured"
176159
)
177160

178161
endpoint = self.AZURE_AI_AGENT_ENDPOINT
@@ -183,6 +166,22 @@ def get_ai_project_client(self):
183166
logging.error("Failed to create AIProjectClient: %s", exc)
184167
raise
185168

169+
def get_user_local_browser_language(self) -> str:
170+
"""Get the user's local browser language from environment variables.
171+
172+
Returns:
173+
The user's local browser language or 'en-US' if not set
174+
"""
175+
return self._get_optional("USER_LOCAL_BROWSER_LANGUAGE", "en-US")
176+
177+
def set_user_local_browser_language(self, language: str):
178+
"""Set the user's local browser language in environment variables.
179+
180+
Args:
181+
language: The language code to set (e.g., 'en-US')
182+
"""
183+
os.environ["USER_LOCAL_BROWSER_LANGUAGE"] = language
184+
186185

187186
# Create a global instance of AppConfig
188187
config = AppConfig()

0 commit comments

Comments
 (0)