Skip to content

Commit 0c6814f

Browse files
fix config issue
1 parent 7cf3cb5 commit 0c6814f

File tree

8 files changed

+17
-18
lines changed

8 files changed

+17
-18
lines changed

src/api/.env.sample

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
APPINSIGHTS_INSTRUMENTATIONKEY=
2+
APPLICATIONINSIGHTS_CONNECTION_STRING=
3+
AZURE_AI_AGENT_ENDPOINT=
4+
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME=
25
AZURE_AI_PROJECT_CONN_STRING=
36
AZURE_AI_SEARCH_API_KEY=
47
AZURE_AI_SEARCH_ENDPOINT=
@@ -7,14 +10,13 @@ AZURE_COSMOSDB_ACCOUNT=
710
AZURE_COSMOSDB_CONVERSATIONS_CONTAINER="conversations"
811
AZURE_COSMOSDB_DATABASE="db_conversation_history"
912
AZURE_COSMOSDB_ENABLE_FEEDBACK="True"
10-
AZURE_OPENAI_DEPLOYMENT_MODEL="gpt-4o-mini"
11-
AZURE_OPENAI_ENDPOINT=
1213
AZURE_OPENAI_API_VERSION=
14+
AZURE_OPENAI_DEPLOYMENT_MODEL=
15+
AZURE_OPENAI_ENDPOINT=
1316
AZURE_OPENAI_RESOURCE=
17+
DISPLAY_CHART_DEFAULT="False"
18+
REACT_APP_LAYOUT_CONFIG="{\n \"appConfig\": {\n \"THREE_COLUMN\": {\n \"DASHBOARD\": 50,\n \"CHAT\": 33,\n \"CHATHISTORY\": 17\n },\n \"TWO_COLUMN\": {\n \"DASHBOARD_CHAT\": {\n \"DASHBOARD\": 65,\n \"CHAT\": 35\n },\n \"CHAT_CHATHISTORY\": {\n \"CHAT\": 80,\n \"CHATHISTORY\": 20\n }\n }\n },\n \"charts\": [\n {\n \"id\": \"SATISFIED\",\n \"name\": \"Satisfied\",\n \"type\": \"card\",\n \"layout\": { \"row\": 1, \"column\": 1, \"height\": 11 }\n },\n {\n \"id\": \"TOTAL_CALLS\",\n \"name\": \"Total Calls\",\n \"type\": \"card\",\n \"layout\": { \"row\": 1, \"column\": 2, \"span\": 1 }\n },\n {\n \"id\": \"AVG_HANDLING_TIME\",\n \"name\": \"Average Handling Time\",\n \"type\": \"card\",\n \"layout\": { \"row\": 1, \"column\": 3, \"span\": 1 }\n },\n {\n \"id\": \"SENTIMENT\",\n \"name\": \"Topics Overview\",\n \"type\": \"donutchart\",\n \"layout\": { \"row\": 2, \"column\": 1, \"width\": 40, \"height\": 44.5 }\n },\n {\n \"id\": \"AVG_HANDLING_TIME_BY_TOPIC\",\n \"name\": \"Average Handling Time By Topic\",\n \"type\": \"bar\",\n \"layout\": { \"row\": 2, \"column\": 2, \"row-span\": 2, \"width\": 60 }\n },\n {\n \"id\": \"TOPICS\",\n \"name\": \"Trending Topics\",\n \"type\": \"table\",\n \"layout\": { \"row\": 3, \"column\": 1, \"span\": 2 }\n },\n {\n \"id\": \"KEY_PHRASES\",\n \"name\": \"Key Phrases\",\n \"type\": \"wordcloud\",\n \"layout\": { \"row\": 3, \"column\": 2, \"height\": 44.5 }\n }\n ]\n}"
1419
SQLDB_DATABASE=
1520
SQLDB_SERVER=
16-
SQLDB_USER_MID=
17-
SQLDB_USERNAME=
1821
USE_AI_PROJECT_CLIENT="False"
1922
USE_CHAT_HISTORY_ENABLED="True"
20-
WEBSITE_HTTPLOGGING_RETENTION_DAYS=

src/api/common/config/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self):
3030

3131
# AI Project Client configuration
3232
self.use_ai_project_client = os.getenv("USE_AI_PROJECT_CLIENT", "False").lower() == "true"
33-
self.azure_ai_project_conn_string = os.getenv("AZURE_AI_PROJECT_CONN_STRING")
33+
self.ai_project_endpoint = os.getenv("AZURE_AI_AGENT_ENDPOINT")
3434

3535
# Chat history configuration
3636
self.use_chat_history_enabled = os.getenv("USE_CHAT_HISTORY_ENABLED", "false").strip().lower() == "true"

src/api/helpers/chat_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import uuid
66
import logging
77
from helpers.azure_openai_helper import get_azure_openai_client
8+
from common.config.config import Config
89

910
# Configure logger
1011
logger = logging.getLogger(__name__)

src/api/plugins/chat_with_data_plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010

1111
from semantic_kernel.functions.kernel_function_decorator import kernel_function
1212
from azure.ai.projects import AIProjectClient
13+
from azure.identity import DefaultAzureCredential
1314

1415
from common.database.sqldb_service import execute_sql_query
16+
from common.config.config import Config
1517
from helpers.azure_openai_helper import get_azure_openai_client
1618

1719

1820
class ChatWithDataPlugin:
1921
def __init__(self):
2022
config = Config()
2123
self.azure_openai_deployment_model = config.azure_openai_deployment_model
22-
self.azure_openai_endpoint = config.azure_openai_endpoint
23-
self.azure_openai_api_version = config.azure_openai_api_version
24+
self.ai_project_endpoint = config.ai_project_endpoint
2425
self.azure_ai_search_endpoint = config.azure_ai_search_endpoint
2526
self.azure_ai_search_api_key = config.azure_ai_search_api_key
2627
self.azure_ai_search_index = config.azure_ai_search_index
2728
self.use_ai_project_client = config.use_ai_project_client
28-
self.azure_ai_project_conn_string = config.azure_ai_project_conn_string
2929

3030
@kernel_function(name="Greeting",
3131
description="Respond to any greeting or general questions")
@@ -34,8 +34,8 @@ async def greeting(self, input: Annotated[str, "the question"]) -> Annotated[str
3434

3535
try:
3636
if self.use_ai_project_client:
37-
project = AIProjectClient.from_connection_string(
38-
conn_str=self.azure_ai_project_conn_string,
37+
project = AIProjectClient(
38+
endpoint=self.ai_project_endpoint,
3939
credential=DefaultAzureCredential()
4040
)
4141
client = project.inference.get_chat_completions_client()
@@ -84,8 +84,8 @@ async def get_SQL_Response(
8484

8585
try:
8686
if self.use_ai_project_client:
87-
project = AIProjectClient.from_connection_string(
88-
conn_str=self.azure_ai_project_conn_string,
87+
project = AIProjectClient(
88+
endpoint=self.ai_project_endpoint,
8989
credential=DefaultAzureCredential()
9090
)
9191
client = project.inference.get_chat_completions_client()

src/api/services/chat_service.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from helpers.utils import format_stream_response
2929
from helpers.azure_openai_helper import get_azure_openai_client
30+
from common.config.config import Config
3031

3132
# Constants
3233
HOST_NAME = "CKM"
@@ -79,8 +80,6 @@ class ChatService:
7980

8081
def __init__(self, request : Request):
8182
config = Config()
82-
self.azure_openai_endpoint = config.azure_openai_endpoint
83-
self.azure_openai_api_version = config.azure_openai_api_version
8483
self.azure_openai_deployment_name = config.azure_openai_deployment_model
8584
self.agent = request.app.state.agent
8685

src/api/services/history_service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(self):
3030
)
3131

3232
self.azure_openai_endpoint = config.azure_openai_endpoint
33-
self.azure_openai_api_key = config.azure_openai_api_key
3433
self.azure_openai_api_version = config.azure_openai_api_version
3534
self.azure_openai_deployment_name = config.azure_openai_deployment_model
3635
self.azure_openai_resource = config.azure_openai_resource

src/tests/api/common/config/test_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def test_config_initialization(mock_env_vars):
4343
# Azure OpenAI config
4444
assert config.azure_openai_endpoint == "https://openai.test"
4545
assert config.azure_openai_deployment_model == "gpt-4"
46-
assert config.azure_openai_api_key == "test_key"
4746
assert config.azure_openai_api_version == "2023-03-15-preview"
4847
assert config.azure_openai_resource == "test_resource"
4948

src/tests/api/services/test_history_service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def mock_config_instance():
1515
config.azure_cosmosdb_conversations_container = "test-container"
1616
config.azure_cosmosdb_enable_feedback = True
1717
config.azure_openai_endpoint = "https://test-openai.openai.azure.com/"
18-
config.azure_openai_api_key = "test-api-key"
1918
config.azure_openai_api_version = "2024-02-15-preview"
2019
config.azure_openai_deployment_model = "gpt-4o-mini"
2120
config.azure_openai_resource = "test-resource"

0 commit comments

Comments
 (0)