Conversation
… to gpt-4o Agent-Logs-Url: https://github.com/TriResolve-AI/grounded-knowledge-assistant/sessions/6069e4cf-bd84-44e3-bc55-61e227ad5e7c Co-authored-by: portiajefferson <67895258+portiajefferson@users.noreply.github.com>
…arch index default Agent-Logs-Url: https://github.com/TriResolve-AI/grounded-knowledge-assistant/sessions/b7b214fd-4472-4d49-925b-d146c2f4b18c Co-authored-by: portiajefferson <67895258+portiajefferson@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates environment-variable configuration across the frontend and both backend implementations, aiming to standardize Azure connection settings and make the frontend API base URL configurable via Vite.
Changes:
- Renames Azure Blob connection string env var usage to
AZURE_BLOB_CONNECTION_STRINGacross audit/blob services. - Makes the frontend API base URL configurable via
import.meta.env.VITE_API_URLand adds a frontend.env.example. - Updates backend Azure/OpenAI defaults (e.g., default completion deployment and search index name) and adds a repo-wide
.env.example.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
services/auditService.js |
Switches audit blob connection env var name to AZURE_BLOB_CONNECTION_STRING. |
frontend/src/App.jsx |
Uses VITE_API_URL for API base instead of hardcoded localhost. |
frontend/.env.example |
Documents VITE_API_URL for frontend configuration. |
backend/services/openaiService.js |
Updates default Azure OpenAI completion deployment to gpt-4o. |
backend/services/blobService.js |
Switches blob connection env var name to AZURE_BLOB_CONNECTION_STRING. |
backend/services/auditService.js |
Updates local-fallback detection to use AZURE_BLOB_CONNECTION_STRING. |
backend/config/azureConfig.js |
Refactors Azure client construction (Blob/Search/OpenAI) and changes default index name. |
.env.example |
Adds a consolidated environment template for local/dev configuration. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…N_STRING as fallback across all blob services Agent-Logs-Url: https://github.com/TriResolve-AI/grounded-knowledge-assistant/sessions/52f2b27c-f935-484f-957d-1141eef7547f Co-authored-by: portiajefferson <67895258+portiajefferson@users.noreply.github.com>
|
|
||
| function isLocalFallbackEnabled() { | ||
| return !process.env.AZURE_STORAGE_CONNECTION_STRING; | ||
| return !process.env.AZURE_BLOB_CONNECTION_STRING; |
There was a problem hiding this comment.
isLocalFallbackEnabled() only checks AZURE_BLOB_CONNECTION_STRING. If an environment still uses the legacy AZURE_STORAGE_CONNECTION_STRING, this will incorrectly enable the local fallback and bypass Blob storage even though Blob is configured. Update the check to treat Blob as configured when either env var is set (same fallback logic used elsewhere).
| return !process.env.AZURE_BLOB_CONNECTION_STRING; | |
| return !( | |
| process.env.AZURE_BLOB_CONNECTION_STRING || | |
| process.env.AZURE_STORAGE_CONNECTION_STRING | |
| ); |
| this.client = openaiClient; | ||
| this.embeddingDeployment = process.env.AZURE_OPENAI_EMBEDDING_DEPLOYMENT || "text-embedding-ada-002"; | ||
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4"; | ||
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4o"; |
There was a problem hiding this comment.
The default AZURE_OPENAI_DEPLOYMENT fallback is now gpt-4o, but this service calls OpenAIClient.getCompletions(...) (legacy completions API). GPT‑4o deployments are intended for chat-style APIs and are not compatible with the completions endpoint; this default is likely to fail at runtime. Either switch this implementation to getChatCompletions(...) with messages, or keep the default aligned with a completions-compatible instruct deployment (e.g. gpt-35-turbo-instruct).
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-4o"; | |
| this.completionDeployment = process.env.AZURE_OPENAI_DEPLOYMENT || "gpt-35-turbo-instruct"; |
There was a problem hiding this comment.
@megan-nepshinsky will you check this comment please. GPT‑4o is the correct deployment but I am not sure how your code is setup and don't want to break anything. I am also not sure as to how @steffahv may have wired the chat deployments in the background either. So I just want to make sure before making any changes.
| searchClient = new SearchClient( | ||
| process.env.AZURE_SEARCH_ENDPOINT, | ||
| process.env.AZURE_SEARCH_INDEX || "documents", | ||
| process.env.AZURE_SEARCH_INDEX || "cg-knowledge-index", | ||
| new AzureKeyCredential(process.env.AZURE_SEARCH_KEY) | ||
| ); |
There was a problem hiding this comment.
This changes the default search index from "documents" to "cg-knowledge-index". If AZURE_SEARCH_INDEX isn’t set in existing deployments, this will silently point the runtime at a different index (and likely break search/ingest). If intentional, it should be called out in the PR description and/or accompanied by migration notes; otherwise consider keeping the prior default.
There was a problem hiding this comment.
@copilot documents was initially there as a placeholder and cg-knowledge-index is the correct index but perhaps you should set documents as a fallback just in case.
There was a problem hiding this comment.
Done in commit 98ee1d7. The hardcoded default is restored to "documents" so existing deployments without AZURE_SEARCH_INDEX set keep working as before. cg-knowledge-index is documented as the recommended value in .env.example, so new deployments will pick it up via the env var.
…index documented in .env.example Agent-Logs-Url: https://github.com/TriResolve-AI/grounded-knowledge-assistant/sessions/b3869fd0-36a2-4d35-9330-34bbdf742f99 Co-authored-by: portiajefferson <67895258+portiajefferson@users.noreply.github.com>
portiajefferson
left a comment
There was a problem hiding this comment.
@megan-nepshinsky & @steffahv will you check this commit to ensure that the suggestions by co-pilot are on par with how you have it wired on the backend @megan-nepshinsky and how you have deployments setup @steffahv Thank you.
megan-nepshinsky
left a comment
There was a problem hiding this comment.
I am good with the changes! Thank you so much, Portia!
Summary
Audits and standardizes Azure environment variable configuration across the frontend and both backend implementations. Hardens all Azure client initializations to support partially-configured environments, and ensures backward compatibility with legacy env var names during a transition period. All blob connection string references across the codebase now consistently accept both
AZURE_BLOB_CONNECTION_STRING(preferred) andAZURE_STORAGE_CONNECTION_STRING(legacy fallback) to avoid breaking existing deployments. The search index default is restored to"documents"for backward compatibility with unconfigured deployments;cg-knowledge-indexis documented as the recommended value in.env.exampleand is used by any deployment that setsAZURE_SEARCH_INDEXexplicitly.Workstream
Expected Review Path
Files Changed
backend/config/azureConfig.js– guarded BlobServiceClient, SearchIndexClient/SearchClient, and OpenAIClient initializations; exportsnull+warnMissingwhen required vars are absent; acceptsAZURE_BLOB_CONNECTION_STRING || AZURE_STORAGE_CONNECTION_STRINGandAZURE_OPENAI_KEY || AZURE_OPENAI_API_KEY; restored"documents"as hardcoded search index fallback for backward compatibilitybackend/services/blobService.js– readsAZURE_BLOB_CONNECTION_STRING || AZURE_STORAGE_CONNECTION_STRINGfor backward compatibility; updated error message to name both accepted var namesbackend/routes/documents.js– updated 503 error message to reference both accepted blob connection string env var namesservices/auditService.js– readsAZURE_BLOB_CONNECTION_STRING || AZURE_STORAGE_CONNECTION_STRINGfor backward compatibility; updated error message to name both accepted var namesfrontend/.env.example– added withVITE_API_URLdocumented.env.example– added repo-wide example with all required Azure env vars;AZURE_SEARCH_INDEX=cg-knowledge-indexdocumented as the recommended search index nameValidation
Risk / Impact
Notes on impact, blockers, or follow-up work:
Legacy env var
AZURE_STORAGE_CONNECTION_STRINGis accepted as a fallback alongside the preferredAZURE_BLOB_CONNECTION_STRINGto avoid breaking existing deployments. Similarly,AZURE_OPENAI_API_KEYis accepted alongsideAZURE_OPENAI_KEY. Once all environments have been updated, the legacy fallbacks can be removed.The hardcoded default for
AZURE_SEARCH_INDEXis"documents"(restored for backward compatibility). Deployments should setAZURE_SEARCH_INDEX=cg-knowledge-indexexplicitly — as documented in.env.example— to use the correct project index.The default
AZURE_OPENAI_DEPLOYMENTfallback value (gpt-4o) has been flagged as a potential incompatibility with the legacygetCompletions(...)API used inbackend/services/openaiService.js. This is pending review by @megan-nepshinsky and @steffahv before any change is made to avoid breaking existing deployment wiring.Governance / Compliance Check
Deployment Notes
Preferred env var names going forward:
AZURE_BLOB_CONNECTION_STRING(replacesAZURE_STORAGE_CONNECTION_STRING)AZURE_OPENAI_KEY(replacesAZURE_OPENAI_API_KEY)AZURE_SEARCH_INDEX=cg-knowledge-index(should be set explicitly; code falls back to"documents"if unset)Both old blob and OpenAI key names remain functional as fallbacks until environments are migrated.
Reviewer Notes
Focus on the guarded client initialization pattern in
backend/config/azureConfig.js— all Azure clients now exportnulland emit a startup warning when required env vars are absent, matching the existing 503-response pattern in route handlers. All four files that read the blob connection string (backend/config/azureConfig.js,backend/services/blobService.js,backend/routes/documents.js, andservices/auditService.js) are now consistent in accepting both the new and legacy env var names. The search index default is"documents"to avoid silently breaking existing unconfigured deployments; setAZURE_SEARCH_INDEX=cg-knowledge-indexin your environment to use the correct project index.Pending: The
AZURE_OPENAI_DEPLOYMENTdefault inbackend/services/openaiService.jsis awaiting confirmation from @megan-nepshinsky and @steffahv on whethergpt-4ois compatible with thegetCompletions(...)call path before any adjustment is made.⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.