diff --git a/packages/builder/src/pages/builder/portal/settings/ai/AIConfigTile.svelte b/packages/builder/src/pages/builder/portal/settings/ai/AIConfigTile.svelte index 2907919ce7..fb040204c2 100644 --- a/packages/builder/src/pages/builder/portal/settings/ai/AIConfigTile.svelte +++ b/packages/builder/src/pages/builder/portal/settings/ai/AIConfigTile.svelte @@ -4,6 +4,7 @@ import OpenAILogo from "./logos/OpenAI.svelte" import AnthropicLogo from "./logos/Anthropic.svelte" import TogetherAILogo from "./logos/TogetherAI.svelte" + import AzureOpenAILogo from "./logos/AzureOpenAI.svelte" import { Providers } from "./constants" const logos = { @@ -11,6 +12,7 @@ [Providers.OpenAI.name]: OpenAILogo, [Providers.Anthropic.name]: AnthropicLogo, [Providers.TogetherAI.name]: TogetherAILogo, + [Providers.AzureOpenAI.name]: AzureOpenAILogo, } export let config @@ -26,8 +28,8 @@
@@ -110,7 +112,7 @@ .tag { display: flex; - color: var(--spectrum-body-m-text-color); + color: #ffffff; padding: 4px 8px; justify-content: center; align-items: center; diff --git a/packages/builder/src/pages/builder/portal/settings/ai/AISettings.spec.js b/packages/builder/src/pages/builder/portal/settings/ai/AISettings.spec.js index fafead1ebf..300d5d5369 100644 --- a/packages/builder/src/pages/builder/portal/settings/ai/AISettings.spec.js +++ b/packages/builder/src/pages/builder/portal/settings/ai/AISettings.spec.js @@ -1,6 +1,6 @@ import { it, expect, describe, vi } from "vitest" import AISettings from "./index.svelte" -import { render } from "@testing-library/svelte" +import { render, fireEvent } from "@testing-library/svelte" import { admin, licensing } from "stores/portal" import { notifications } from "@budibase/bbui" @@ -55,39 +55,43 @@ describe("AISettings", () => { expect(enterpriseTag).toBeInTheDocument() }) - it("should show the premium label on cloud when Budibase AI isn't enabled", async () => { - setupEnv(Hosting.Cloud) - instance = render(AISettings, {}) - const premiumTag = instance.queryByText("Premium") - expect(premiumTag).toBeInTheDocument() - }) - - it("should not show the add configuration button if the user doesn't have the correct license on cloud", async () => { + it("the add configuration button should not do anything the user doesn't have the correct license on cloud", async () => { let addConfigurationButton + let configModal setupEnv(Hosting.Cloud) instance = render(AISettings) addConfigurationButton = instance.queryByText("Add configuration") - expect(addConfigurationButton).not.toBeInTheDocument() + expect(addConfigurationButton).toBeInTheDocument() + await fireEvent.click(addConfigurationButton) + configModal = instance.queryByText("Custom AI Configuration") + expect(configModal).not.toBeInTheDocument() + }) + + it("the add configuration button should open the config modal if the user has the correct license on cloud", async () => { + let addConfigurationButton + let configModal setupEnv(Hosting.Cloud, { customAIConfigsEnabled: true }) instance = render(AISettings) addConfigurationButton = instance.queryByText("Add configuration") expect(addConfigurationButton).toBeInTheDocument() + await fireEvent.click(addConfigurationButton) + configModal = instance.queryByText("Custom AI Configuration") + expect(configModal).toBeInTheDocument() }) - it("should not show the add configuration button if the user doesn't have the correct license on self host", async () => { + it("the add configuration button should open the config modal if the user has the correct license on self host", async () => { let addConfigurationButton - - setupEnv(Hosting.Self) - instance = render(AISettings) - addConfigurationButton = instance.queryByText("Add configuration") - expect(addConfigurationButton).not.toBeInTheDocument() + let configModal setupEnv(Hosting.Self, { customAIConfigsEnabled: true }) - instance = render(AISettings, {}) + instance = render(AISettings) addConfigurationButton = instance.queryByText("Add configuration") expect(addConfigurationButton).toBeInTheDocument() + await fireEvent.click(addConfigurationButton) + configModal = instance.queryByText("Custom AI Configuration") + expect(configModal).toBeInTheDocument() }) }) }) diff --git a/packages/builder/src/pages/builder/portal/settings/ai/ConfigModal.svelte b/packages/builder/src/pages/builder/portal/settings/ai/ConfigModal.svelte index d480689028..26e7a1606c 100644 --- a/packages/builder/src/pages/builder/portal/settings/ai/ConfigModal.svelte +++ b/packages/builder/src/pages/builder/portal/settings/ai/ConfigModal.svelte @@ -84,8 +84,10 @@
- - +
+ + +
diff --git a/packages/builder/src/pages/builder/portal/settings/ai/logos/AzureOpenAI.svelte b/packages/builder/src/pages/builder/portal/settings/ai/logos/AzureOpenAI.svelte new file mode 100644 index 0000000000..647a32c9eb --- /dev/null +++ b/packages/builder/src/pages/builder/portal/settings/ai/logos/AzureOpenAI.svelte @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/builder/src/pages/builder/portal/settings/index.svelte b/packages/builder/src/pages/builder/portal/settings/index.svelte index 09ead3e410..1448b43ec4 100644 --- a/packages/builder/src/pages/builder/portal/settings/index.svelte +++ b/packages/builder/src/pages/builder/portal/settings/index.svelte @@ -1,5 +1,10 @@