Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: feature guard (#5069)

Liu Ji1dfd08f01b77
diff --git a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
index 23b05e1905..6eed499c90 100644
--- a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
+++ b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
@@ -18,6 +18,11 @@
$t("settings.general.workspace.plugin.openai.openai-key.self")
}}</span>
+ <FeatureBadge
+ feature="bb.feature.plugin.openai"
+ class="text-accent"
+ />
+
<span
v-if="!allowEdit"
class="text-sm text-gray-400 -translate-y-2 tooltip"
@@ -62,22 +67,32 @@
</div>
</div>
</div>
+
+ <FeatureModal
+ v-if="state.showFeatureModal"
+ feature="bb.feature.plugin.openai"
+ @cancel="state.showFeatureModal = false"
+ />
</div>
</template>
<script lang="ts" setup>
import { computed, reactive, watchEffect } from "vue";
+import { useI18n } from "vue-i18n";
import {
+ hasFeature,
pushNotification,
useCurrentUser,
useSettingByName,
useSettingStore,
} from "@/store";
import { hasWorkspacePermission } from "@/utils";
-import { useI18n } from "vue-i18n";
+import FeatureBadge from "@/components/FeatureBadge.vue";
+import FeatureModal from "@/components/FeatureModal.vue";
interface LocalState {
openAIKey: string;
+ showFeatureModal: boolean;
}
const { t } = useI18n();
@@ -86,6 +101,7 @@ const currentUser = useCurrentUser();
const state = reactive<LocalState>({
openAIKey: "",
+ showFeatureModal: false,
});
const openAIKeySetting = useSettingByName("bb.plugin.openai.key");
@@ -114,6 +130,11 @@ const handleOpenAIKeyChange = (event: InputEvent) => {
};
const updateOpenAIKey = async () => {
+ if (!hasFeature("bb.feature.plugin.openai")) {
+ state.showFeatureModal = true;
+ return;
+ }
+
if (!allowSave.value) {
return;
}
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 36b458be8b..33de6e1c90 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1771,6 +1771,10 @@
"bb-feature-2fa": {
"title": "Two-Factor Authentication (2FA)",
"desc": "Two-factor authentication provides an extra layer of security for member accounts. When signing in, you will be required to enter the security code generated by your Authenticator App."
+ },
+ "bb-feature-plugin-openai": {
+ "title": "AI Augmentation",
+ "desc": "AI augmented SQL Editor features powered by OpenAI."
}
}
},
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 3b6122aa35..05da41d56c 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1770,6 +1770,10 @@
"bb-feature-2fa": {
"title": "双重认证",
"desc": "双重认证为系统成员提供了一个额外的安全层。在登录时,用户需要输入由认证器应用程序生成的安全代码。"
+ },
+ "bb-feature-plugin-openai": {
+ "title": "AI 增强",
+ "desc": "AI 增强的 SQL 编辑器功能,基于 OpenAI 技术驱动。"
}
}
},