Use AzureOpenAI client and clean up env config in chat & image apps#37
Merged
jack-williams merged 2 commits intomainfrom May 4, 2026
Merged
Use AzureOpenAI client and clean up env config in chat & image apps#37jack-williams merged 2 commits intomainfrom
jack-williams merged 2 commits intomainfrom
Conversation
- Switch to the SDK's AzureOpenAI client when VITE_OPENAI_BASE_URL is set so
Azure auth uses the supported single api-key header path with api-version,
instead of the base OpenAI client with a manually-injected baseURL.
- Drop the dead process.env.OPENAI_* fallbacks. vite.config.ts defines
process.env as {}, so those reads were inlined as undefined at build time
and never did anything.
- Read VITE_OPENAI_API_VERSION (new) and use it when constructing the Azure
client. Update vite-env.d.ts on both apps with the new optional types.
- Default chat model is now gpt-4.1 to match the rest of the codebase.
- Mirror the .env.example layout across both apps and comment out the optional
vars so copying .env.example does not silently activate the Azure path with
a placeholder URL.
- Document the optional VITE_OPENAI_* configuration in the README.
Co-authored-by: Jace Medlin <32235747+based-jace@users.noreply.github.com>
…nd API versatility (#38) * Updated documentation and .env.example to include model limitations and API versatility * Ran prettier on README --------- Co-authored-by: Jace Medlin (AIM Consulting Addison Group) <v-jacemedlin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleans up how the chat & image apps configure their OpenAI client.
Changes
Use the dedicated
AzureOpenAIclient when a base URL is setWhen
VITE_OPENAI_BASE_URLis set, the apps now construct the SDK'sAzureOpenAIclass instead of the baseOpenAIclass with a rawbaseURL. This uses the supported Azure auth path (singleapi-keyheader +api-versionquery param) instead of relying on the SDK's OpenAI defaults to talk to Azure.Drop the dead
process.env.OPENAI_*fallbacksapps/*/vite.config.tsdefinesprocess.envas{}, so everyprocess.env.OPENAI_*reference inChatService/ImageServicewas inlined asundefinedat build time and contributed nothing. The fallbacks looked plausible (a user might think settingOPENAI_BASE_URLwould work) but silently did nothing. Configuration is now read only fromimport.meta.env.VITE_OPENAI_*, the supported way to surface env vars to a Vite client bundle.New
VITE_OPENAI_API_VERSIONenv varRequired when
VITE_OPENAI_BASE_URLpoints at Azure OpenAI. Threaded through to theAzureOpenAIconstructor. Added tovite-env.d.tsfor both apps.Default chat model is now
gpt-4.1Matches the existing default elsewhere in the codebase. Override with
VITE_OPENAI_MODEL.Tidy
.env.examplefor both appsOptional
VITE_OPENAI_BASE_URL/VITE_OPENAI_API_VERSION/VITE_OPENAI_MODELare commented out with realistic example values. Mirrors layout across both apps.Document the optional config in the README
A new "Optional configuration" section covers
VITE_OPENAI_MODEL,VITE_OPENAI_BASE_URL, andVITE_OPENAI_API_VERSIONfor both apps.Context
Builds on the env-driven configuration introduced in #23. Co-authored with @based-jace, who did related groundwork in #31.
Verification
yarn typecheckpassesyarn buildpassesyarn prettier:checkpasses