Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ node_modules/
# React build output
src/api/static/react/
.vscode/launch.json
.DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why?

7 changes: 4 additions & 3 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"setup": "npm install -g [email protected] && pnpm install && pnpm build",
"setup": "pnpm install && pnpm build",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This have been resolved in the latest code.

"preview": "vite preview",
"typecheck": "tsc --noEmit"
},
Expand All @@ -27,6 +27,7 @@
"@vitejs/plugin-react": "4.4.1",
"clsx": "2.1.1",
"copy-to-clipboard": "^3.3.3",
"prismjs": "1.30.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This have been resolved in the latest code.

"react": "19.1.0",
"react-dom": "19.1.0",
"react-markdown": "10.1.0",
Expand All @@ -40,8 +41,8 @@
"remark-math": "^6.0.0",
"remark-parse": "^11.0.0",
"remark-supersub": "^1.0.0",
"vite": "6.3.4",
"prismjs": "1.30.0"
"setup": "^0.0.3",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been resolved in the latest code.

"vite": "6.3.4"
},
"devDependencies": {
"@types/node": "22.14.1",
Expand Down
24 changes: 16 additions & 8 deletions src/frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions src/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from azure.ai.projects.models import ConnectionType, ApiKeyCredentials
from azure.identity.aio import DefaultAzureCredential
from azure.core.credentials_async import AsyncTokenCredential
from azure.core.credentials import AzureKeyCredential

from dotenv import load_dotenv

Expand Down Expand Up @@ -66,22 +67,24 @@ async def create_index_maybe(
"""
from api.search_index_manager import SearchIndexManager
endpoint = os.environ.get('AZURE_AI_SEARCH_ENDPOINT')
embedding = os.getenv('AZURE_AI_EMBED_DEPLOYMENT_NAME')
if endpoint and embedding:
embedding = os.getenv('AZURE_AI_EMBED_DEPLOYMENT_NAME')
search_api_key = os.getenv('AZURE_AI_SEARCH_API_KEY') # <-- Add this line

if endpoint and embedding and search_api_key:
try:
aoai_connection = await ai_client.connections.get_default(
connection_type=ConnectionType.AZURE_OPEN_AI, include_credentials=True)
except ValueError as e:
logger.error("Error creating index: {e}")
logger.error(f"Error creating index: {e}")
return

embed_api_key = None
if aoai_connection.credentials and isinstance(aoai_connection.credentials, ApiKeyCredentials):
embed_api_key = aoai_connection.credentials.api_key

search_mgr = SearchIndexManager(
endpoint=endpoint,
credential=creds,
credential=AzureKeyCredential(search_api_key), # <-- Use API key here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't store api key as env var for security unless the key is set. The latest code is using AAD. So this isn't necessary.

index_name=os.getenv('AZURE_AI_SEARCH_INDEX_NAME'),
dimensions=None,
model=embedding,
Expand Down Expand Up @@ -253,4 +256,8 @@ def on_starting(server):
if __name__ == "__main__":
print("Running initialize_resources directly...")
asyncio.run(initialize_resources())
print("initialize_resources finished.")
print("initialize_resources finished.")