Browse Source

fix(nc-gui): prompt ester egg pending issues

pull/9997/head
Ramesh Mane 3 days ago
parent
commit
6f6e54b1b5
  1. 3
      packages/nc-gui/components/dashboard/TreeView/CreateViewBtn.vue
  2. 18
      packages/nc-gui/components/smartsheet/column/LongTextOptions.vue
  3. 10
      packages/nc-gui/components/smartsheet/topbar/ViewListDropdown.vue

3
packages/nc-gui/components/dashboard/TreeView/CreateViewBtn.vue

@ -16,7 +16,6 @@ const { refreshCommandPalette } = useCommandPalette()
const viewsStore = useViewsStore()
const { loadViews, navigateToView } = viewsStore
const { aiIntegrationAvailable } = useNocoAi()
const { isFeatureEnabled } = useBetaFeatureToggle()
const table = inject(SidebarTableInj)!
@ -197,7 +196,7 @@ async function onOpenModal({
<GeneralIcon v-else class="plus" icon="plus" />
</div>
</NcMenuItem>
<template v-if="aiIntegrationAvailable && isFeatureEnabled(FEATURE_FLAG.AI_FEATURES)">
<template v-if="isFeatureEnabled(FEATURE_FLAG.AI_FEATURES)">
<NcDivider />
<NcMenuItem data-testid="sidebar-view-create-ai" @click="onOpenModal({ type: 'AI' })">
<div class="item">

18
packages/nc-gui/components/smartsheet/column/LongTextOptions.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { UITypes } from 'nocodb-sdk'
import { isAIPromptCol, UITypes } from 'nocodb-sdk'
const props = defineProps<{
modelValue: any
@ -105,6 +105,15 @@ const generate = async () => {
generatingPreview.value = false
}
const isPromptEnabled = computed(() => {
console.log('isAiPrompt', isAIPromptCol(column.value))
if (isEdit.value) {
return isAIPromptCol(column.value)
}
return isFeatureEnabled(FEATURE_FLAG.AI_FEATURES)
})
onMounted(() => {
// set default value
vModel.value.prompt_raw = (column?.value?.colOptions as Record<string, any>)?.prompt_raw || ''
@ -183,8 +192,7 @@ watch(
</NcTooltip>
</a-form-item>
<template v-if="isFeatureEnabled(FEATURE_FLAG.AI_FEATURES)">
<div class="relative">
<div v-if="isPromptEnabled" class="relative">
<a-form-item class="flex items-center">
<NcTooltip :disabled="!richMode" class="flex items-center">
<template #title> Generate text using AI is not supported when rich text formatting is enabled </template>
@ -232,7 +240,7 @@ watch(
</div>
</a-form-item>
</div>
<template v-if="!isEdit ? aiIntegrationAvailable && isEnabledGenerateText : isEnabledGenerateText">
<template v-if="isPromptEnabled && (!isEdit ? aiIntegrationAvailable && isEnabledGenerateText : isEnabledGenerateText)">
<a-form-item class="flex">
<div class="nc-prompt-input-wrapper bg-nc-bg-gray-light rounded-lg w-full">
<AiPromptWithFields
@ -328,7 +336,7 @@ watch(
</template>
</template>
<AiIntegrationNotFound v-if="!aiIntegrationAvailable && isEnabledGenerateText" />
<AiIntegrationNotFound v-if="!aiIntegrationAvailable && isEnabledGenerateText && isPromptEnabled" />
</div>
</template>

10
packages/nc-gui/components/smartsheet/topbar/ViewListDropdown.vue

@ -21,7 +21,7 @@ const { loadViews, navigateToView } = viewsStore
const { refreshCommandPalette } = useCommandPalette()
const { aiIntegrationAvailable } = useNocoAi()
const { isFeatureEnabled } = useBetaFeatureToggle()
const isOpen = ref<boolean>(false)
@ -254,17 +254,15 @@ async function onOpenModal({
</div>
</a-menu-item>
<template v-if="isFeatureEnabled(FEATURE_FLAG.AI_FEATURES)">
<NcDivider />
<a-menu-item
v-if="aiIntegrationAvailable"
data-testid="sidebar-view-create-ai"
@click="onOpenModal({ type: 'AI' })"
>
<a-menu-item data-testid="sidebar-view-create-ai" @click="onOpenModal({ type: 'AI' })">
<div class="nc-viewlist-submenu-popup-item">
<GeneralIcon icon="ncAutoAwesome" class="!w-4 !h-4 text-nc-fill-purple-dark" />
<div>{{ $t('labels.aiSuggested') }}</div>
</div>
</a-menu-item>
</template>
</a-sub-menu>
</a-menu>
</div>

Loading…
Cancel
Save