Skip to content

Add text list attribute for sharepoint integration tags #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {
const sampleRecordsFinal = useMemo(() => {
if (sampleRecords && sampleRecords.calculatedAttributesDisplay) {
return sampleRecords.calculatedAttributesDisplay.map((record: any, index) => {
const calculatedValue = currentAttributesRef.current.dataType != DataTypeEnum.EMBEDDING_LIST ? record : { id: record.id, value: JSON.parse(record.value) }
let calculatedValue;
if (currentAttributesRef.current.dataType == DataTypeEnum.EMBEDDING_LIST) {
calculatedValue = { id: record.id, value: JSON.parse(record.value) };
}
if (currentAttributesRef.current.dataType == DataTypeEnum.TEXT_LIST) {
calculatedValue = { id: record.id, value: JSON.stringify(record) };
}
else {
calculatedValue = record
}
return {
...record,
onClick: viewRecordDetails(index),
Expand All @@ -85,7 +94,6 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {
);
}
}, [sampleRecords]);

return (<div>
<div className="mt-8 text-sm leading-5">
<div className="text-gray-700 font-medium mr-2">
Expand Down Expand Up @@ -136,7 +144,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {
<div key={record.id} className="divide-y divide-gray-200 bg-white">
<div className="flex-shrink-0 border-b border-gray-200 shadow-sm flex justify-between items-center">
<div className="flex items-center text-xs leading-5 text-gray-500 font-normal mx-4 my-3 text-justify">
{String(record.value)}
{String(record?.calculatedValue?.value)}
</div>
<div className="flex items-center justify-center mr-5 ml-auto">
<KernButton
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/record-display/RecordDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function RecordDisplay(props: any) {
</div>
</div>
{attributesDict[attribute.id] && <div className="text-gray-800 text-sm mb-4 overflow-anywhere flex text-left">
{attribute.dataType === DataTypeEnum.EMBEDDING_LIST || attribute.dataType === DataTypeEnum.PERMISSION ? (<div className="flex flex-col gap-y-1 divide-y">
{attribute.dataType === DataTypeEnum.EMBEDDING_LIST || attribute.dataType === DataTypeEnum.PERMISSION || attribute.dataType === DataTypeEnum.TEXT_LIST ? (<div className="flex flex-col gap-y-1 divide-y">
{preparedRecord.data[attributesDict[attribute.key].name] ? preparedRecord.data[attributesDict[attribute.key].name].map((item, indexJ) => (<div key={indexJ} className="pt-1">
{(configuration.highlightText && isTextHighlightNeeded[attribute.key]) ? (<Highlight text={item.toString()}
additionalClasses={[configuration.lineBreaks == LineBreaksType.NORMAL ? '' : (configuration.lineBreaks == LineBreaksType.IS_PRE_WRAP ? 'whitespace-pre-wrap' : 'whitespace-pre-line')]}
Expand Down
1 change: 1 addition & 0 deletions src/types/shared/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export enum DataTypeEnum {
EMBEDDING_LIST = "EMBEDDING_LIST",
LLM_RESPONSE = "LLM_RESPONSE",
PERMISSION = "PERMISSION",
TEXT_LIST = "TEXT_LIST",
}
5 changes: 5 additions & 0 deletions src/util/classes/attribute-calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ async def ac(record):

llm_response = await get_llm_response()
return llm_response.get("result") or "no result provided"
`
}
case DataTypeEnum.TEXT_LIST: return {
code: `def ac(record):
return ["Hello World"]
`
}
default: return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const DATA_TYPES = [
{ name: 'Embedding List', value: 'EMBEDDING_LIST' },
{ name: 'LLM Response', value: 'LLM_RESPONSE' },
{ name: 'Permission', value: 'PERMISSION' },
{ name: 'Text List', value: 'TEXT_LIST' }
];

export const ATTRIBUTES_VISIBILITY_STATES = [
Expand Down Expand Up @@ -54,6 +55,7 @@ export function getColorForDataType(dataType): string {
case DataTypeEnum.FLOAT: return 'purple';
case DataTypeEnum.EMBEDDING_LIST: return 'rose';
case DataTypeEnum.LLM_RESPONSE: return 'emerald';
case DataTypeEnum.TEXT_LIST: return 'blue';
default: return 'gray';
}
}
Expand Down