Skip to content

Commit 965f106

Browse files
committed
Fix(openai) handle azure more correctly fix #430
close #430
1 parent 0d6f928 commit 965f106

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/api/providers/openai.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler {
1717
constructor(options: ApiHandlerOptions) {
1818
this.options = options
1919
// Azure API shape slightly differs from the core API shape: https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai
20-
const urlHost = new URL(this.options.openAiBaseUrl ?? "").host
21-
if (urlHost === "azure.com" || urlHost.endsWith(".azure.com")) {
20+
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure.com")) {
2221
this.client = new AzureOpenAI({
2322
baseURL: this.options.openAiBaseUrl,
2423
apiKey: this.options.openAiApiKey,

0 commit comments

Comments
 (0)