This commit is contained in:
Martin McKeaveney 2024-09-10 14:50:17 +01:00
parent 0cf626be91
commit 933ca952d2
4 changed files with 20 additions and 13 deletions

View File

@ -24,7 +24,11 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div on:click class:disabled class="option">
<div class="icon">
<svelte:component this={logos[config.name || config.provider]} height="30" width="30" />
<svelte:component
this={logos[config.name || config.provider]}
height="30"
width="30"
/>
</div>
<div class="header">
<Body>{config.provider}</Body>

View File

@ -3,7 +3,7 @@ import { admin } from "./admin"
import { auth } from "./auth"
import { isEnabled } from "helpers/featureFlags"
import { sdk } from "@budibase/shared-core"
import { FeatureFlag } from "@budibase/types";
import { FeatureFlag } from "@budibase/types"
export const menu = derived([admin, auth], ([$admin, $auth]) => {
const user = $auth?.user
@ -65,12 +65,10 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
},
]
if (isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) {
settingsSubPages.push(
{
title: "AI",
href: "/builder/portal/settings/ai",
}
)
settingsSubPages.push({
title: "AI",
href: "/builder/portal/settings/ai",
})
}
if (!cloud) {

View File

@ -343,7 +343,9 @@ async function enrichAIConfig(aiConfig: AIConfig) {
// Return the Budibase AI data source as part of the response if licensing allows
const budibaseAIEnabled = await pro.features.isBudibaseAIEnabled()
const defaultConfigExists = Object.keys(aiConfig.config).some(key => aiConfig.config[key].isDefault)
const defaultConfigExists = Object.keys(aiConfig.config).some(
key => aiConfig.config[key].isDefault
)
if (budibaseAIEnabled) {
aiConfig.config["budibase_ai"] = {
provider: "OpenAI",

View File

@ -45,7 +45,9 @@ describe("Global configs controller", () => {
})
it("Should return the default BB AI config when the feature is turned on", async () => {
jest.spyOn(pro.features, "isBudibaseAIEnabled").mockImplementation(() => true)
jest
.spyOn(pro.features, "isBudibaseAIEnabled")
.mockImplementation(() => true)
configs.getConfig.mockResolvedValue({
config: {
ai: {
@ -81,7 +83,9 @@ describe("Global configs controller", () => {
})
it("Should not not return the default Budibase AI config when on self host", async () => {
jest.spyOn(pro.features, "isBudibaseAIEnabled").mockImplementation(() => false)
jest
.spyOn(pro.features, "isBudibaseAIEnabled")
.mockImplementation(() => false)
configs.getConfig.mockResolvedValue({
config: {
ai: {
@ -140,7 +144,6 @@ describe("Global configs controller", () => {
await verifyAIConfig(newConfig, existingConfig)
// should be unchanged
expect(newConfig.config.aiconfig.apiKey === "myapikey")
expect(newConfig.config.aiconfig.apiKey).toEqual("myapikey")
})
})