Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: add ai fields in plan features

Ramesh Maneab8f0efbdf6b
diff --git a/packages/nc-gui/components/payment/upgrade/Badge.vue b/packages/nc-gui/components/payment/upgrade/Badge.vue
index 5072525b87..dc70a78721 100644
--- a/packages/nc-gui/components/payment/upgrade/Badge.vue
+++ b/packages/nc-gui/components/payment/upgrade/Badge.vue
@@ -2,7 +2,8 @@
/**
* PaymentUpgradeBadge component - will only visible if feature is not available in current plan
*/
-import type { PlanFeatureTypes } from 'nocodb-sdk'
+import type { PlanFeatureTypes, PlanLimitTypes } from 'nocodb-sdk'
+
import { PlanTitles } from 'nocodb-sdk'
interface Props {
/** Required plan to access new feature */
diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
index 1ace687856..15331604c4 100644
--- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
+++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
@@ -185,7 +185,7 @@ const uiFilters = (t: UiTypesType) => {
const specificDBType = t.name === UITypes.SpecificDBType && isXcdbBase(meta.value?.source_id)
const showDeprecatedField = !t.deprecated || showDeprecated.value
- const showAiFields = [AIPrompt, AIButton].includes(t.name) ? isAiBetaFeaturesEnabled.value && !isEdit.value : true
+ const showAiFields = [AIPrompt, AIButton].includes(t.name) ? isAiBetaFeaturesEnabled.value && !isEdit.value && isEeUI : true
const isAllowToAddInFormView = isForm.value ? !formViewHiddenColTypes.includes(t.name) : true
const showLTAR =
diff --git a/packages/nc-gui/components/smartsheet/column/UITypesOptionsWithSearch.vue b/packages/nc-gui/components/smartsheet/column/UITypesOptionsWithSearch.vue
index ceeb0e3634..cf755a8306 100644
--- a/packages/nc-gui/components/smartsheet/column/UITypesOptionsWithSearch.vue
+++ b/packages/nc-gui/components/smartsheet/column/UITypesOptionsWithSearch.vue
@@ -10,10 +10,12 @@ const emits = defineEmits<{ selected: [UITypes] }>()
const { options } = toRefs(props)
-const searchQuery = ref('')
-
const { isMetaReadOnly } = useRoles()
+const { showUpgradeToUseAiPromptField } = useEeConfig()
+
+const searchQuery = ref('')
+
const searchBasisInfoMap = ref<Record<string, string>>({})
const filteredOptions = computed(() => {
@@ -43,6 +45,10 @@ const isDisabledUIType = (type: UITypes) => {
const onClick = (uidt: UITypes) => {
if (!uidt || isDisabledUIType(uidt)) return
+ if (uidt === AIPrompt && showUpgradeToUseAiPromptField()) {
+ return
+ }
+
emits('selected', uidt)
}
diff --git a/packages/nc-gui/composables/useEeConfig.ts b/packages/nc-gui/composables/useEeConfig.ts
index faa50d1c9a..37d95b0950 100644
--- a/packages/nc-gui/composables/useEeConfig.ts
+++ b/packages/nc-gui/composables/useEeConfig.ts
@@ -72,6 +72,8 @@ export const useEeConfig = createSharedComposable(() => {
return Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 50)
})
+ const blockAiPromptField = computed(() => true)
+
const calculatePrice = (..._args: any[]) => {}
const getLimit = (..._args: any[]) => {}
@@ -132,6 +134,8 @@ export const useEeConfig = createSharedComposable(() => {
const showUpgradeToUseCalendarRange = (..._args: any[]) => {}
+ const showUpgradeToUseAiPromptField = (..._args: any[]) => {}
+
return {
calculatePrice,
getLimit,
@@ -192,5 +196,7 @@ export const useEeConfig = createSharedComposable(() => {
blockCalendarRange,
showUpgradeToUseCalendarRange,
isOrgBilling,
+ blockAiPromptField,
+ showUpgradeToUseAiPromptField,
}
})
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 7b13b41c15..d0f534f589 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -175,7 +175,9 @@
"upgradeToUsePrivateBasesSubtitle": "Private bases are available on the {plan} plan. Upgrade now to start using them.",
"upgradeLicenseToUsePrivateBases": "Upgrade license to unlock private bases",
"upgradeLicenseToUsePrivateBasesSubtitle": "Private bases are not available in Enterprise Starter license. Upgrade license key to start using them.",
- "upgradeToAddMoreAttachmentsInCellSubtitle": "You can only upload at most {limit} {filePlural} to this cell. Upgrade to the {plan} plan to add more files."
+ "upgradeToAddMoreAttachmentsInCellSubtitle": "You can only upload at most {limit} {filePlural} to this cell. Upgrade to the {plan} plan to add more files.",
+ "upgradeToUseAiTextField": "Upgrade to use AI text fields",
+ "upgradeToUseAiTextFieldSubtitle": "Upgrade to the {plan} plan to use AI text fields to generate text based on your prompt."
},
"general": {
"script": "Script",
diff --git a/packages/nocodb-sdk/src/lib/payment/index.ts b/packages/nocodb-sdk/src/lib/payment/index.ts
index b57acf9b54..84f84f0410 100644
--- a/packages/nocodb-sdk/src/lib/payment/index.ts
+++ b/packages/nocodb-sdk/src/lib/payment/index.ts
@@ -58,6 +58,8 @@ export enum PlanFeatureTypes {
FEATURE_API_MEMBER_MANAGEMENT = 'feature_api_member_management',
FEATURE_API_VIEW_V3 = 'feature_api_view_v3',
FEATURE_CALENDAR_RANGE = 'feature_calendar_range',
+ FEATURE_AI_PROMPT_FIELD = 'feature_ai_prompt_field',
+ FEATURE_AI_BUTTON_FIELD = 'feature_ai_button_field',
}
// todo: separate as a new enum
@@ -248,6 +250,8 @@ export const PlanFeatureUpgradeMessages: Record<PlanFeatureTypes, string> = {
[PlanFeatureTypes.FEATURE_API_VIEW_V3]: 'to use view api.',
[PlanFeatureTypes.FEATURE_CALENDAR_RANGE]:
'to visualize records in a calendar range.',
+ [PlanFeatureTypes.FEATURE_AI_PROMPT_FIELD]: 'to use AI text fields.',
+ [PlanFeatureTypes.FEATURE_AI_BUTTON_FIELD]: 'to use AI button fields.',
};
export const getUpgradeMessage = (