Add Azure AD Token field to Add Model Azure and make API Key not required (#16331)

This commit is contained in:
yuneng-jiang 2025-11-06 09:52:39 -08:00 • committed by GitHub
parent ee50f09e73
commit b5956e0595
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 7 deletions

View file

@ -62,4 +62,39 @@ describe("ProviderSpecificFields", () => {
expect(apiKeyLabel).toBeInTheDocument();
});
});
it("should render the provider specific fields for Azure", async () => {
const { getByLabelText, getByPlaceholderText } = render(
<Form>
<ProviderSpecificFields selectedProvider={Providers.Azure} />
</Form>,
);
await waitFor(() => {
// Check for API Base field
const apiBaseInput = getByPlaceholderText("https://...");
expect(apiBaseInput).toBeInTheDocument();
expect(apiBaseInput).toHaveAttribute("type", "text");
// Check for API Version field
const apiVersionInput = getByPlaceholderText("2023-07-01-preview");
expect(apiVersionInput).toBeInTheDocument();
// Check for Base Model field
const baseModelInput = getByPlaceholderText("azure/gpt-3.5-turbo");
expect(baseModelInput).toBeInTheDocument();
// Check for API Key field
const apiKeyInput = getByLabelText("Azure API Key");
expect(apiKeyInput).toBeInTheDocument();
expect(apiKeyInput).toHaveAttribute("type", "password");
expect(apiKeyInput).toHaveAttribute("placeholder", "Enter your Azure API Key");
// Check for Azure AD Token field
const azureAdTokenInput = getByLabelText("Azure AD Token");
expect(azureAdTokenInput).toBeInTheDocument();
expect(azureAdTokenInput).toHaveAttribute("type", "password");
expect(azureAdTokenInput).toHaveAttribute("placeholder", "Enter your Azure AD Token");
});
});
});

View file

@ -164,7 +164,15 @@ const PROVIDER_CREDENTIAL_FIELDS: Record<Providers, ProviderCredentialField[]> =
key: "api_key",
label: "Azure API Key",
type: "password",
required: true,
placeholder: "Enter your Azure API Key",
required: false,
},
{
key: "azure_ad_token",
label: "Azure AD Token",
type: "password",
placeholder: "Enter your Azure AD Token",
required: false,
},
],
[Providers.Azure_AI_Studio]: [

View file

@ -512,12 +512,7 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
}}
>
<div>
<Button
style={{ width: "150px" }}
onClick={() =>
setIsAddSSOModalVisible(true)
}
>
<Button style={{ width: "150px" }} onClick={() => setIsAddSSOModalVisible(true)}>
{ssoConfigured ? "Edit SSO Settings" : "Add SSO"}
</Button>
</div>