lint
This commit is contained in:
parent
0cf626be91
commit
933ca952d2
|
@ -24,7 +24,11 @@
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<div on:click class:disabled class="option">
|
<div on:click class:disabled class="option">
|
||||||
<div class="icon">
|
<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>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<Body>{config.provider}</Body>
|
<Body>{config.provider}</Body>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { admin } from "./admin"
|
||||||
import { auth } from "./auth"
|
import { auth } from "./auth"
|
||||||
import { isEnabled } from "helpers/featureFlags"
|
import { isEnabled } from "helpers/featureFlags"
|
||||||
import { sdk } from "@budibase/shared-core"
|
import { sdk } from "@budibase/shared-core"
|
||||||
import { FeatureFlag } from "@budibase/types";
|
import { FeatureFlag } from "@budibase/types"
|
||||||
|
|
||||||
export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||||
const user = $auth?.user
|
const user = $auth?.user
|
||||||
|
@ -65,12 +65,10 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
if (isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) {
|
if (isEnabled(FeatureFlag.AI_CUSTOM_CONFIGS)) {
|
||||||
settingsSubPages.push(
|
settingsSubPages.push({
|
||||||
{
|
title: "AI",
|
||||||
title: "AI",
|
href: "/builder/portal/settings/ai",
|
||||||
href: "/builder/portal/settings/ai",
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cloud) {
|
if (!cloud) {
|
||||||
|
|
|
@ -343,7 +343,9 @@ async function enrichAIConfig(aiConfig: AIConfig) {
|
||||||
|
|
||||||
// Return the Budibase AI data source as part of the response if licensing allows
|
// Return the Budibase AI data source as part of the response if licensing allows
|
||||||
const budibaseAIEnabled = await pro.features.isBudibaseAIEnabled()
|
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) {
|
if (budibaseAIEnabled) {
|
||||||
aiConfig.config["budibase_ai"] = {
|
aiConfig.config["budibase_ai"] = {
|
||||||
provider: "OpenAI",
|
provider: "OpenAI",
|
||||||
|
|
|
@ -45,7 +45,9 @@ describe("Global configs controller", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should return the default BB AI config when the feature is turned on", async () => {
|
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({
|
configs.getConfig.mockResolvedValue({
|
||||||
config: {
|
config: {
|
||||||
ai: {
|
ai: {
|
||||||
|
@ -81,7 +83,9 @@ describe("Global configs controller", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should not not return the default Budibase AI config when on self host", async () => {
|
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({
|
configs.getConfig.mockResolvedValue({
|
||||||
config: {
|
config: {
|
||||||
ai: {
|
ai: {
|
||||||
|
@ -140,7 +144,6 @@ describe("Global configs controller", () => {
|
||||||
|
|
||||||
await verifyAIConfig(newConfig, existingConfig)
|
await verifyAIConfig(newConfig, existingConfig)
|
||||||
// should be unchanged
|
// should be unchanged
|
||||||
expect(newConfig.config.aiconfig.apiKey === "myapikey")
|
expect(newConfig.config.aiconfig.apiKey).toEqual("myapikey")
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue