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