Skip to content

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

fix(nc-gui): add generated by ai text in both places sidebar and discussion mode

Ramesh Maneeffccab0491d
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
index 25b5c02d5f..f5eb00a38d 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
@@ -122,11 +122,22 @@ function isShowableValue(value: any) {
function shouldShowRaw(key: string) {
return ['URL', 'PhoneNumber', 'Email'].includes(meta.value?.[key]?.type)
}
+
+const isAiGeneratedText = (key: string) => {
+ return (
+ isAIPromptCol({
+ uidt: meta.value?.[key]?.type,
+ dt: meta.value?.[key]?.type === 'Number' ? 'bigint' : undefined,
+ meta: normalizeMeta(key),
+ }) &&
+ (!ncIsObject(newData.value[key]) || !newData.value[key]?.lastModifiedBy)
+ )
+}
</script>
<template>
<div v-for="columnKey of columnKeys" :key="columnKey" class="py-2 px-3">
- <div class="flex items-center gap-1 !text-nc-content-gray-subtle2 text-xs font-weight-500 nc-audit-mini-item-header">
+ <div class="w-full flex items-center gap-1 !text-nc-content-gray-subtle2 text-xs font-weight-500 nc-audit-mini-item-header">
<SmartsheetHeaderCellIcon
:column-meta="{
uidt: meta[columnKey]?.type,
@@ -135,29 +146,22 @@ function shouldShowRaw(key: string) {
}"
class="!m-0"
/>
- <NcTooltip class="truncate" show-on-truncate-only>
+ <NcTooltip
+ class="truncate"
+ :class="{
+ 'max-w-1/2': isAiGeneratedText(columnKey),
+ }"
+ show-on-truncate-only
+ >
<template #title>
{{ columnKey }}
</template>
{{ columnKey }}
</NcTooltip>
- <NcTooltip
- v-if="
- isAIPromptCol({
- uidt: meta[columnKey]?.type,
- dt: meta[columnKey]?.type === 'Number' ? 'bigint' : undefined,
- meta: normalizeMeta(columnKey),
- }) &&
- (!ncIsObject(newData[columnKey]) || !newData[columnKey]?.lastModifiedBy)
- "
- class="truncate text-xs text-nc-content-purple-medium"
- show-on-truncate-only
- >
- <template #title> Generated by AI </template>
-
+ <span v-if="isAiGeneratedText(columnKey)" class="whitespace-nowrap text-xs text-nc-content-purple-medium">
(Generated by AI)
- </NcTooltip>
+ </span>
</div>
<div class="flex items-center gap-2 mt-3 flex-wrap">
<template v-if="meta[columnKey]?.type === 'Attachment'">
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
index 059fb4a051..1f3babd4b6 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { AttachmentType, AuditType } from 'nocodb-sdk'
-import { checkboxIconListMap, parseHelper, ratingIconListMap } from 'nocodb-sdk'
+import { checkboxIconListMap, parseHelper, isAIPromptCol, ratingIconListMap } from 'nocodb-sdk'
/* interface */
@@ -110,6 +110,17 @@ function shouldUseUniformPadding(key: string) {
function isShowableValue(value: any) {
return ![undefined, null, ''].includes(value)
}
+
+const isAiGeneratedText = (key: string) => {
+ return (
+ isAIPromptCol({
+ uidt: meta.value?.[key]?.type,
+ dt: meta.value?.[key]?.type === 'Number' ? 'bigint' : undefined,
+ meta: normalizeMeta(key),
+ }) &&
+ (!ncIsObject(newData.value[key]) || !newData.value[key]?.lastModifiedBy)
+ )
+}
</script>
<template>
@@ -124,10 +135,10 @@ function isShowableValue(value: any) {
]"
/>
<div class="ml-6.5">
- <div class="text-small1 font-weight-500 inline-flex items-center flex-wrap gap-1 w-full max-w-full">
+ <div class="text-small1 font-weight-500 inline-flex items-center flex-wrap gap-1 !w-full !max-w-full">
<span class="text-nc-content-gray-subtle2 text-xs"> changed </span>
<span
- class="rounded-md px-1 !h-[20px] inline-flex items-center gap-1 text-nc-content-gray-emphasis border-1 border-nc-border-gray-medium"
+ class="rounded-md px-1 !h-[20px] inline-flex items-center gap-1 text-nc-content-gray-emphasis border-1 border-nc-border-gray-medium max-w-full"
>
<SmartsheetHeaderCellIcon
:column-meta="{
@@ -143,10 +154,12 @@ function isShowableValue(value: any) {
{{ columnKey }}
</template>
- <span class="text-small1 font-weight-500">
- {{ columnKey }}
- </span>
+ {{ columnKey }}
</NcTooltip>
+
+ <span v-if="isAiGeneratedText(columnKey)" class="whitespace-nowrap text-xs text-nc-content-purple-medium">
+ (Generated by AI)
+ </span>
</span>
<template v-if="meta[columnKey]?.type === 'Attachment'">
<div v-if="processOldDataFor(columnKey)?.length > 0" class="w-full">