feat: add explicit Azure OpenAI flag and setup memory bank docs

- Add openAiUseAzure flag to force Azure OpenAI client initialization
- Add "Use Azure" checkbox in API settings UI

This change improves Azure OpenAI configuration flexibility by allowing users to explicitly opt-in to Azure client, regardless of the base URL pattern.
This commit is contained in:
sam hoang
2025-01-24 00:14:55 +07:00
parent 0d6f928f9f
commit f745f080f4
4 changed files with 17 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler {
this.options = options
// Azure API shape slightly differs from the core API shape: https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai
const urlHost = new URL(this.options.openAiBaseUrl ?? "").host
if (urlHost === "azure.com" || urlHost.endsWith(".azure.com")) {
if (urlHost === "azure.com" || urlHost.endsWith(".azure.com") || options.openAiUseAzure) {
this.client = new AzureOpenAI({
baseURL: this.options.openAiBaseUrl,
apiKey: this.options.openAiApiKey,