- {record.fullRecordData[props.selectedAttribute]}
+ {Array.isArray(record.fullRecordData[props.selectedAttribute]) ? JSON.stringify(record.fullRecordData[props.selectedAttribute]) : record.fullRecordData[props.selectedAttribute]}
{Object.entries(record.calculatedLabelsResult).map(([key, value]: any) => (
diff --git a/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx b/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx
index 2e7f8893..d7d5c3c9 100644
--- a/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx
+++ b/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx
@@ -28,6 +28,7 @@ import { createLabel } from "@/src/services/base/labeling-tasks";
import { addClassificationLabels, addExtractionLabel, deleteRecordLabelAssociationByIds, removeGoldStar, setGoldStar } from "@/src/services/base/labeling"
import KernButton from "@/submodules/react-components/components/kern-button/KernButton"
import { MemoIconAlertCircle, MemoIconAssembly, MemoIconBolt, MemoIconCode, MemoIconStar } from "@/submodules/react-components/components/kern-icons/icons"
+import { DataTypeEnum } from "@/src/types/shared/general"
const L_VARS = getDefaultLabelingVars();
@@ -568,9 +569,20 @@ export default function LabelingSuiteLabeling() {
}}
setSelected={(start, end, e) => setSelected(attribute.id, start, end, e)} />) : (<>
{(recordRequests.record.data[lVars.taskLookup[attribute.id].attribute.name] != null && recordRequests.record.data[lVars.taskLookup[attribute.id].attribute.name] !== '') ?
- (
- {`${recordRequests.record.data[lVars.taskLookup[attribute.id].attribute.name]}`}
-
) : (<>
+ (<>
+ {(attribute.dataType == DataTypeEnum.TEXT_LIST || attribute.dataType == DataTypeEnum.EMBEDDING_LIST) ?
+ {recordRequests.record.data[lVars.taskLookup[attribute.id].attribute.name].map((text, index) => (
+
+ {text}
+
+ ))}
+
:
+
+ {`${recordRequests.record.data[lVars.taskLookup[attribute.id].attribute.name]}`}
+
+ }
+ >
+ ) : (<>
Not present in the
record
diff --git a/src/components/projects/projectId/playground/PlaygroundSearchMetaFilterModal.tsx b/src/components/projects/projectId/playground/PlaygroundSearchMetaFilterModal.tsx
index 4bd6c59e..dfb1a77f 100644
--- a/src/components/projects/projectId/playground/PlaygroundSearchMetaFilterModal.tsx
+++ b/src/components/projects/projectId/playground/PlaygroundSearchMetaFilterModal.tsx
@@ -58,9 +58,14 @@ export default function PlaygroundSearchMetaFilterModal(props: { selectedEmbeddi
const newTooltipsDict = {};
filterAttributesSS.forEach((attribute) => {
- const attributeType = attributes.find(att => att.name == attribute)?.dataType
- newOperatorsDict[attribute] = FILTER_INTEGRATION_OPERATORS.filter(operator => attributeType == DataTypeEnum.INTEGER || operator !== FilterIntegrationOperator.BETWEEN);
- newTooltipsDict[attribute] = FILTER_INTEGRATION_OPERATOR_TOOLTIPS.filter(tooltip => attributeType == DataTypeEnum.INTEGER || tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
+ const attributeType = attributes.find(att => att.name == attribute)?.dataType;
+ if (attributeType == DataTypeEnum.TEXT_LIST) {
+ newOperatorsDict[attribute] = [FilterIntegrationOperator.EQUAL];
+ newTooltipsDict[attribute] = [getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.EQUAL)];
+ } else {
+ newOperatorsDict[attribute] = FILTER_INTEGRATION_OPERATORS.filter(operator => attributeType == DataTypeEnum.INTEGER || operator !== FilterIntegrationOperator.BETWEEN);
+ newTooltipsDict[attribute] = FILTER_INTEGRATION_OPERATOR_TOOLTIPS.filter(tooltip => attributeType == DataTypeEnum.INTEGER || tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
+ }
colors.push(getColorForDataType(attributeType));
});
setOperatorsDict(newOperatorsDict);
diff --git a/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx b/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx
index fe1f3249..64d8c45b 100644
--- a/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx
+++ b/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx
@@ -99,7 +99,7 @@ export default function AddNewEmbeddingModal() {
function checkIfAttributeHasToken() {
const attribute = useableEmbedableAttributes.find((a) => a.id == targetAttribute.id);
- if (attribute?.dataType == DataTypeEnum.EMBEDDING_LIST) {
+ if (attribute?.dataType == DataTypeEnum.EMBEDDING_LIST || attribute?.dataType == DataTypeEnum.TEXT_LIST) {
setGranularityArray(GRANULARITY_TYPES_ARRAY.filter((g) => g.value != EmbeddingType.ON_TOKEN));
} else {
checkIfPlatformHasToken();
diff --git a/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx b/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx
index ff5fad1d..113adc18 100644
--- a/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx
+++ b/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx
@@ -1,5 +1,5 @@
import { openModal, setModalStates } from "@/src/reduxStore/states/modal";
-import { selectLabelingTasksAll, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings";
+import { selectAttributes, selectLabelingTasksAll, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings";
import { selectProjectId } from "@/src/reduxStore/states/project";
import { LabelType, LabelTypeWithOnClick, LabelingTask, LabelingTaskTaskType, LabelingTaskWithOnClick } from "@/src/types/components/projects/projectId/settings/labeling-tasks";
import { ModalEnum } from "@/src/types/shared/modal";
@@ -20,13 +20,15 @@ import { updateLabelingTask } from "@/src/services/base/labeling-tasks";
import IconButton from "@/submodules/react-components/components/kern-button/IconButton";
import KernButton from "@/submodules/react-components/components/kern-button/KernButton";
import { MemoIconColorPicker, MemoIconPlus, MemoIconTrash } from "@/submodules/react-components/components/kern-icons/icons";
-import { useConsoleLog } from "@/submodules/react-components/hooks/useConsoleLog";
+import { DataTypeEnum } from "@/src/types/shared/general";
export default function LabelingTasks() {
const dispatch = useDispatch();
const projectId = useSelector(selectProjectId);
const labelingTasksSchema = useSelector(selectLabelingTasksAll);
+ const attributes = useSelector(selectAttributes);
+
const [labelingTasksDropdownArray, setLabelingTasksDropdownArray] = useState<{ name: string, value: string }[]>([]);
@@ -103,9 +105,10 @@ export default function LabelingTasks() {
...labelingTask,
onDelete: () => dispatch(setModalStates(ModalEnum.DELETE_LABELING_TASK, { taskId: labelingTask.id, open: true })),
labels: labelingTask.labels.map((label) => ({ ...label, onDelete: deleteLabel(labelingTask, label), onChangeColor: changeColorLabel(labelingTask, label) })),
+ attributeType: attributes.find(att => att.name == labelingTask.targetName)?.dataType
}
))
- }, [labelingTasksSchema]);
+ }, [labelingTasksSchema, attributes]);
return (
@@ -153,7 +156,7 @@ export default function LabelingTasks() {
updateLabelingTaskType(task, index, labelingTaskFromString(option.name))} />
|
diff --git a/src/components/shared/record-display/RecordDisplay.tsx b/src/components/shared/record-display/RecordDisplay.tsx
index 6af65606..0f41aee3 100644
--- a/src/components/shared/record-display/RecordDisplay.tsx
+++ b/src/components/shared/record-display/RecordDisplay.tsx
@@ -33,7 +33,7 @@ export function RecordDisplay(props: any) {
{attributesDict[attribute.id] &&
- {attribute.dataType === DataTypeEnum.EMBEDDING_LIST || attribute.dataType === DataTypeEnum.PERMISSION ? (
+ {attribute.dataType === DataTypeEnum.EMBEDDING_LIST || attribute.dataType === DataTypeEnum.PERMISSION || attribute.dataType === DataTypeEnum.TEXT_LIST ? (
{preparedRecord.data[attributesDict[attribute.key].name] ? preparedRecord.data[attributesDict[attribute.key].name].map((item, indexJ) => (
{(configuration.highlightText && isTextHighlightNeeded[attribute.key]) ? ( void;
clearSearchRequest: () => void;
+};
+
+export type DataBrowserSidebarProps = {
+ clearRequest: boolean;
+}
+
+export type SearchGroupsProps = {
+ clearRequest: boolean;
};
\ No newline at end of file
diff --git a/src/types/components/projects/projectId/settings/labeling-tasks.ts b/src/types/components/projects/projectId/settings/labeling-tasks.ts
index 19da8bc5..b2ce45db 100644
--- a/src/types/components/projects/projectId/settings/labeling-tasks.ts
+++ b/src/types/components/projects/projectId/settings/labeling-tasks.ts
@@ -1,3 +1,4 @@
+import { DataTypeEnum } from "@/src/types/shared/general";
import { Attribute } from "./data-schema";
export type LabelingTask = {
@@ -16,6 +17,7 @@ export type LabelingTask = {
export type LabelingTaskWithOnClick = LabelingTask & {
onDelete: () => void;
+ attributeType: DataTypeEnum;
}
export type LabelType = {
diff --git a/src/types/shared/general.ts b/src/types/shared/general.ts
index 75ae07ee..083cdee0 100644
--- a/src/types/shared/general.ts
+++ b/src/types/shared/general.ts
@@ -22,4 +22,5 @@ export enum DataTypeEnum {
EMBEDDING_LIST = "EMBEDDING_LIST",
LLM_RESPONSE = "LLM_RESPONSE",
PERMISSION = "PERMISSION",
+ TEXT_LIST = "TEXT_LIST",
}
\ No newline at end of file
diff --git a/src/util/classes/attribute-calculation.ts b/src/util/classes/attribute-calculation.ts
index e800c099..39e69e65 100644
--- a/src/util/classes/attribute-calculation.ts
+++ b/src/util/classes/attribute-calculation.ts
@@ -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 {
diff --git a/src/util/components/projects/projectId/data-browser/data-browser-helper.ts b/src/util/components/projects/projectId/data-browser/data-browser-helper.ts
index fe0c98a6..0c6594ed 100644
--- a/src/util/components/projects/projectId/data-browser/data-browser-helper.ts
+++ b/src/util/components/projects/projectId/data-browser/data-browser-helper.ts
@@ -5,8 +5,7 @@ import { buildFullLink } from "@/src/util/shared/link-parser-helper";
import { dateAsUTCDate } from "@/submodules/javascript-functions/date-parser";
import { informationSourceTypeToString, labelSourceToString, sliceTypeToString } from "@/submodules/javascript-functions/enums/enum-functions";
import { LabelSource, Slice } from "@/submodules/javascript-functions/enums/enums";
-import { jsonCopy, tryParseJSON } from "@/submodules/javascript-functions/general";
-import { getAttributeType } from "./search-operators-helper";
+import { jsonCopy } from "@/submodules/javascript-functions/general";
export function postProcessDataSlices(dataSlices: DataSlice[]) {
const prepareDataSlices = jsonCopy(dataSlices);
@@ -176,9 +175,15 @@ function parseUTC(utc: string, forOutlier: boolean = false) {
export function postProcessUniqueValues(uniqueValues: any, attributesSortOrder: any) {
const uniqueValuesDict = uniqueValues;
for (let key in uniqueValuesDict) {
- const attributeType = getAttributeType(attributesSortOrder, key);
+ const attributeType = attributesSortOrder.find(att => att.name == key)?.dataType;
if (attributeType == DataTypeEnum.TEXT || attributeType == DataTypeEnum.LLM_RESPONSE) {
delete uniqueValuesDict[key];
+ } else if (attributeType == DataTypeEnum.TEXT_LIST) {
+ const uniqueSet = new Set();
+ for (const item of uniqueValuesDict[key]) {
+ JSON.parse(item).forEach(str => uniqueSet.add(str));
+ }
+ uniqueValuesDict[key] = Array.from(uniqueSet);
}
}
return uniqueValuesDict;
diff --git a/src/util/components/projects/projectId/data-browser/search-groups-helper.ts b/src/util/components/projects/projectId/data-browser/search-groups-helper.ts
index c18a9549..3bfd23da 100644
--- a/src/util/components/projects/projectId/data-browser/search-groups-helper.ts
+++ b/src/util/components/projects/projectId/data-browser/search-groups-helper.ts
@@ -2,6 +2,7 @@ import { SearchGroupElement } from "@/src/types/components/projects/projectId/da
import { SearchGroupItem, SearchItemType } from "@/src/types/components/projects/projectId/data-browser/search-groups";
import { SearchOperator } from "@/src/types/components/projects/projectId/data-browser/search-operators";
import { LabelingTask, LabelingTaskTarget } from "@/src/types/components/projects/projectId/settings/labeling-tasks";
+import { DataTypeEnum } from "@/src/types/shared/general";
import { getOrderByDisplayName, nameForGroupKeyToString } from "@/submodules/javascript-functions/enums/enum-functions";
import { InformationSourceType, SearchGroup, StaticOrderByKeys } from "@/submodules/javascript-functions/enums/enums";
@@ -233,8 +234,9 @@ export function orderByCreateSearchGroup(item, globalSearchGroupCount, attribute
function orderByArray(attributesSortOrder: any[] = [], attributesDict: any) {
let array = [];
- for (let i = 1; i < attributesSortOrder.length; i++) {
- array.push(getOrderByGroup(attributesDict[attributesSortOrder[i].key].name, true, -1)) //1, //-1 desc, 1 asc
+ const finalAttributesSortOrder = attributesSortOrder.filter((a) => a.type !== DataTypeEnum.TEXT_LIST);
+ for (let i = 1; i < finalAttributesSortOrder.length; i++) {
+ array.push(getOrderByGroup(attributesDict[finalAttributesSortOrder[i].key].name, true, -1)) //1, //-1 desc, 1 asc
}
array.push(getOrderByGroup(StaticOrderByKeys.WEAK_SUPERVISION_CONFIDENCE, false, -1));
array.push(getOrderByGroup(StaticOrderByKeys.RANDOM, false, -1));
diff --git a/src/util/components/projects/projectId/data-browser/search-operators-helper.ts b/src/util/components/projects/projectId/data-browser/search-operators-helper.ts
index 93d0aeb7..898f6c4e 100644
--- a/src/util/components/projects/projectId/data-browser/search-operators-helper.ts
+++ b/src/util/components/projects/projectId/data-browser/search-operators-helper.ts
@@ -1,4 +1,5 @@
import { FilterIntegrationOperator, SearchOperator } from "@/src/types/components/projects/projectId/data-browser/search-operators";
+import { DataTypeEnum } from "@/src/types/shared/general";
export function getAttributeType(attributes: any[], attributeName: string) {
return attributes.find(att => att.name == attributeName)?.type;
diff --git a/src/util/components/projects/projectId/settings/data-schema-helper.ts b/src/util/components/projects/projectId/settings/data-schema-helper.ts
index def7053a..79c48f8e 100644
--- a/src/util/components/projects/projectId/settings/data-schema-helper.ts
+++ b/src/util/components/projects/projectId/settings/data-schema-helper.ts
@@ -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 = [
@@ -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 'teal';
default: return 'gray';
}
}
diff --git a/submodules/react-components b/submodules/react-components
index 1f1dc088..05a61ddd 160000
--- a/submodules/react-components
+++ b/submodules/react-components
@@ -1 +1 @@
-Subproject commit 1f1dc08839bbf7e02e1ddafa774af43fdbb7197a
+Subproject commit 05a61ddd39e294a5d101cebcefddcb6344d34f5c
|