diff --git a/packages/nocodb-sdk/src/lib/UITypes.ts b/packages/nocodb-sdk/src/lib/UITypes.ts index ed9c93e567..7c1cee69a8 100644 --- a/packages/nocodb-sdk/src/lib/UITypes.ts +++ b/packages/nocodb-sdk/src/lib/UITypes.ts @@ -1,8 +1,7 @@ import { ColumnReqType, ColumnType, TableType } from './Api'; import { FormulaDataTypes } from './formulaHelpers'; import { LongTextAiMetaProp, RelationTypes } from '~/lib/globals'; -import { parseHelper } from './helperFunctions'; -import { ncParseProp } from './helperFunctions'; +import { parseHelper, ncParseProp } from './helperFunctions'; enum UITypes { ID = 'ID', @@ -217,12 +216,11 @@ export function isVirtualCol( ].includes((typeof col === 'object' ? col?.uidt : col)); } -export function isAIPromptCol( - col: - | ColumnReqType - | ColumnType -) { - return col.uidt === UITypes.LongText && parseHelper((col as any)?.meta)?.[LongTextAiMetaProp]; +export function isAIPromptCol(col: ColumnReqType | ColumnType) { + return ( + col.uidt === UITypes.LongText && + parseHelper((col as any)?.meta)?.[LongTextAiMetaProp] + ); } export function isCreatedOrLastModifiedTimeCol( @@ -381,10 +379,12 @@ export const isSupportedDisplayValueColumn = (column: ColumnType) => { return true; } case UITypes.LongText: { - if (ncParseProp(column.meta)?.richMode) { + if ( + ncParseProp(column.meta)?.richMode || + ncParseProp(column.meta)[LongTextAiMetaProp] + ) { return false; } - //Todo: prevent AI Prompt field once it get merged in develop return true; } diff --git a/packages/nocodb-sdk/src/lib/helperFunctions.ts b/packages/nocodb-sdk/src/lib/helperFunctions.ts index e5a7e3c55c..32567926ff 100644 --- a/packages/nocodb-sdk/src/lib/helperFunctions.ts +++ b/packages/nocodb-sdk/src/lib/helperFunctions.ts @@ -256,7 +256,7 @@ export function parseHelper(v: any): any { export function stringifyHelper(v: any): string { try { - return JSON.stringify(v); + return typeof v === 'string' ? v : JSON.stringify(v); } catch { return v; }