-
Notifications
You must be signed in to change notification settings - Fork 249
[Fix] Azure OpenAI returns 404 with resource endpoint #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
1acc0ae
646693d
3a121b8
dfd281e
6cf5a95
d3688f5
147fb86
fd41164
1afa5f8
bd481dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* v8 ignore file -- Playwright component fixture is covered by the visual test. */ | ||
| import React from "react" | ||
| import { QueryClient, QueryClientProvider } from "@tanstack/react-query" | ||
|
|
||
| import { type ProviderSettings } from "@roo-code/types" | ||
|
|
||
| import { TranslationContext as AppTranslationContext } from "@/i18n/TranslationContext" | ||
| import { TranslationContext as PlaywrightTranslationContext } from "@src/i18n/TranslationContext" | ||
| import { TooltipProvider } from "@src/components/ui/tooltip" | ||
| import { OpenAICompatible } from "../OpenAICompatible" | ||
| import enSettings from "@/i18n/locales/en/settings.json" | ||
|
|
||
| function flattenTranslations(obj: Record<string, unknown>, prefix = "settings:"): Record<string, string> { | ||
| const result: Record<string, string> = {} | ||
| for (const [key, value] of Object.entries(obj)) { | ||
| const fullKey = `${prefix}${key}` | ||
| if (typeof value === "string") { | ||
| result[fullKey] = value | ||
| } else if (value !== null && typeof value === "object" && !Array.isArray(value)) { | ||
| Object.assign(result, flattenTranslations(value as Record<string, unknown>, `${fullKey}.`)) | ||
| } | ||
| } | ||
| return result | ||
| } | ||
|
|
||
| const translations = flattenTranslations(enSettings as Record<string, unknown>) | ||
|
|
||
| const queryClient = new QueryClient({ | ||
| defaultOptions: { | ||
| queries: { retry: false }, | ||
| }, | ||
| }) | ||
|
|
||
| const apiConfiguration: ProviderSettings = { | ||
| apiProvider: "openai", | ||
| openAiBaseUrl: "", | ||
| openAiModelId: "my-gpt4o-deployment", | ||
| openAiUseAzure: true, | ||
| } | ||
|
|
||
| export const OpenAICompatibleAzureFixture = () => ( | ||
| <PlaywrightTranslationContext.Provider | ||
| value={{ | ||
| t: (key) => translations[key] ?? key, | ||
| i18n: null as unknown as typeof import("../../../../i18n/setup").default, | ||
| }}> | ||
| <AppTranslationContext.Provider | ||
| value={{ | ||
| t: (key) => translations[key] ?? key, | ||
| i18n: null as unknown as typeof import("../../../../i18n/setup").default, | ||
| }}> | ||
| <QueryClientProvider client={queryClient}> | ||
| <TooltipProvider> | ||
| <div className="h-[295px] w-[480px] overflow-hidden bg-vscode-editor-background p-4 text-vscode-foreground"> | ||
| <OpenAICompatible | ||
| apiConfiguration={apiConfiguration} | ||
| setApiConfigurationField={() => {}} | ||
| organizationAllowList={{ allowAll: true, providers: {} }} | ||
| simplifySettings | ||
| /> | ||
| </div> | ||
| </TooltipProvider> | ||
| </QueryClientProvider> | ||
| </AppTranslationContext.Provider> | ||
| </PlaywrightTranslationContext.Provider> | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React from "react" | ||
|
|
||
| import { expect, test } from "../../../../../playwright/coverage-fixture" | ||
| import { OpenAICompatibleAzureFixture } from "./OpenAICompatible.visual.fixture" | ||
|
|
||
| test("renders Azure OpenAI endpoint and deployment guidance in the VS Code dark theme", async ({ mount, page }) => { | ||
| // The full provider bundle leaves a bare Zod reference after CT tree-shaking. | ||
| await page.evaluate(() => Object.assign(globalThis, { z: undefined })) | ||
| const component = await mount(<OpenAICompatibleAzureFixture />) | ||
|
|
||
| await component.evaluate((element) => { | ||
| const { document } = element.ownerDocument.defaultView! | ||
| document.documentElement.className = "vscode-dark" | ||
| document.body.className = "vscode-dark" | ||
| document.body.dataset.vscodeThemeId = "Default Dark Modern" | ||
| }) | ||
|
|
||
| await expect | ||
| .poll(() => | ||
| component.evaluate((element) => { | ||
| return getComputedStyle(element.ownerDocument.body) | ||
| .getPropertyValue("--vscode-editor-background") | ||
| .trim() | ||
| }), | ||
| ) | ||
| .toBe("#1e1e1e") | ||
|
|
||
| await component.evaluate(async () => { | ||
| await document.fonts.ready | ||
| await new Promise<void>((resolve) => requestAnimationFrame(() => resolve())) | ||
| }) | ||
|
|
||
| await expect(component).toHaveScreenshot("openai-compatible-azure-guidance-dark.png") | ||
| }) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.