diff --git a/.gitignore b/.gitignore index 6ba7cbcd..c1fe8521 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ node_modules/ # React build output src/api/static/react/ .vscode/launch.json +.DS_Store diff --git a/src/frontend/package.json b/src/frontend/package.json index 6bed8968..31ed2013 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "setup": "npm install -g pnpm@10.4.1 && pnpm install && pnpm build", + "setup": "pnpm install && pnpm build", "preview": "vite preview", "typecheck": "tsc --noEmit" }, @@ -27,6 +27,7 @@ "@vitejs/plugin-react": "4.4.1", "clsx": "2.1.1", "copy-to-clipboard": "^3.3.3", + "prismjs": "1.30.0", "react": "19.1.0", "react-dom": "19.1.0", "react-markdown": "10.1.0", @@ -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", + "vite": "6.3.4" }, "devDependencies": { "@types/node": "22.14.1", diff --git a/src/frontend/pnpm-lock.yaml b/src/frontend/pnpm-lock.yaml index a4f91d12..25435aff 100644 --- a/src/frontend/pnpm-lock.yaml +++ b/src/frontend/pnpm-lock.yaml @@ -40,7 +40,7 @@ importers: version: 9.1.24 '@vitejs/plugin-react': specifier: 4.4.1 - version: 4.4.1(vite@6.3.3(@types/node@22.14.1)) + version: 4.4.1(vite@6.3.4(@types/node@22.14.1)) clsx: specifier: 2.1.1 version: 2.1.1 @@ -89,9 +89,12 @@ importers: remark-supersub: specifier: ^1.0.0 version: 1.0.0 + setup: + specifier: ^0.0.3 + version: 0.0.3 vite: - specifier: 6.3.3 - version: 6.3.3(@types/node@22.14.1) + specifier: 6.3.4 + version: 6.3.4(@types/node@22.14.1) devDependencies: '@types/node': specifier: 22.14.1 @@ -2120,6 +2123,9 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + setup@0.0.3: + resolution: {integrity: sha512-NcuGT1k9V3jdwcNdZzpnO6h2WtLMieaIVRMWeQvlSVRMB6b51T3jeUBSeBzP5Mmqy50viW5y7LRaMaTm/MZ4CA==} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -2230,8 +2236,8 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - vite@6.3.3: - resolution: {integrity: sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw==} + vite@6.3.4: + resolution: {integrity: sha512-BiReIiMS2fyFqbqNT/Qqt4CVITDU9M9vE+DKcVAsB+ZV0wvTKd+3hMbkpxz1b+NmEDMegpVbisKiAZOnvO92Sw==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: @@ -4434,14 +4440,14 @@ snapshots: '@ungap/structured-clone@1.3.0': {} - '@vitejs/plugin-react@4.4.1(vite@6.3.3(@types/node@22.14.1))': + '@vitejs/plugin-react@4.4.1(vite@6.3.4(@types/node@22.14.1))': dependencies: '@babel/core': 7.26.10 '@babel/plugin-transform-react-jsx-self': 7.25.9(@babel/core@7.26.10) '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.10) '@types/babel__core': 7.20.5 react-refresh: 0.17.0 - vite: 6.3.3(@types/node@22.14.1) + vite: 6.3.4(@types/node@22.14.1) transitivePeerDependencies: - supports-color @@ -5384,6 +5390,8 @@ snapshots: semver@6.3.1: {} + setup@0.0.3: {} + source-map-js@1.2.1: {} space-separated-tokens@1.1.5: {} @@ -5517,7 +5525,7 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite@6.3.3(@types/node@22.14.1): + vite@6.3.4(@types/node@22.14.1): dependencies: esbuild: 0.25.3 fdir: 6.4.4(picomatch@4.0.2) diff --git a/src/gunicorn.conf.py b/src/gunicorn.conf.py index c32dce20..2c4da09a 100644 --- a/src/gunicorn.conf.py +++ b/src/gunicorn.conf.py @@ -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 @@ -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 index_name=os.getenv('AZURE_AI_SEARCH_INDEX_NAME'), dimensions=None, model=embedding, @@ -253,4 +256,8 @@ def on_starting(server): if __name__ == "__main__": print("Running initialize_resources directly...") asyncio.run(initialize_resources()) - print("initialize_resources finished.") \ No newline at end of file + print("initialize_resources finished.") + + + +