From e50b8b2b70aa5b73e2f4130f2c7c7f90884336f6 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 22 Jul 2025 18:21:24 +0200 Subject: [PATCH 01/11] text list attribute --- .../attributes/attributeId/ExecutionContainer.tsx | 14 +++++++++++--- src/types/shared/general.ts | 1 + .../projectId/settings/data-schema-helper.ts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx index 70c461c6..de65513a 100644 --- a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx +++ b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx @@ -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), @@ -85,7 +94,6 @@ export default function ExecutionContainer(props: ExecutionContainerProps) { ); } }, [sampleRecords]); - return (
@@ -136,7 +144,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) {
- {String(record.value)} + {String(record?.calculatedValue?.value)}
Date: Wed, 23 Jul 2025 14:29:37 +0200 Subject: [PATCH 02/11] display list --- src/components/shared/record-display/RecordDisplay.tsx | 2 +- src/util/classes/attribute-calculation.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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]) ? ( Date: Wed, 23 Jul 2025 16:39:43 +0200 Subject: [PATCH 03/11] Added color for the new ac type --- .../components/projects/projectId/settings/data-schema-helper.ts | 1 + 1 file changed, 1 insertion(+) 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 c1d979bf..6fc9ff1a 100644 --- a/src/util/components/projects/projectId/settings/data-schema-helper.ts +++ b/src/util/components/projects/projectId/settings/data-schema-helper.ts @@ -55,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'; } } From 67d81a74536187c8c8d30549414d20afeead248f Mon Sep 17 00:00:00 2001 From: Lina Date: Mon, 28 Jul 2025 17:47:43 +0200 Subject: [PATCH 04/11] Added text list to data browser --- .../attributeId/LLM/LLMPlaygroundModal.tsx | 2 +- .../attributeId/ViewRecordDetailsModal.tsx | 9 ++------- .../projectId/data-browser/DataBrowser.tsx | 14 +++++++------- .../projectId/data-browser/SearchGroups.tsx | 14 ++++++++++++-- .../projectId/data-browser/data-browser-helper.ts | 6 +++++- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/LLM/LLMPlaygroundModal.tsx b/src/components/projects/projectId/attributes/attributeId/LLM/LLMPlaygroundModal.tsx index 13314807..8fddc8c4 100644 --- a/src/components/projects/projectId/attributes/attributeId/LLM/LLMPlaygroundModal.tsx +++ b/src/components/projects/projectId/attributes/attributeId/LLM/LLMPlaygroundModal.tsx @@ -155,7 +155,7 @@ export default function LLMPlaygroundModal() {
{recordKeys.map((rk) => - {recordData.map((record) => rk.dataType == DataTypeEnum.EMBEDDING_LIST ?
+ {recordData.map((record) => (rk.dataType == DataTypeEnum.EMBEDDING_LIST || rk.dataType == DataTypeEnum.TEXT_LIST) ?
{record[rk.name].map((li, idx) => {li})}
: {record[rk.name]})} )} diff --git a/src/components/projects/projectId/attributes/attributeId/ViewRecordDetailsModal.tsx b/src/components/projects/projectId/attributes/attributeId/ViewRecordDetailsModal.tsx index 007be4cd..1b0349b5 100644 --- a/src/components/projects/projectId/attributes/attributeId/ViewRecordDetailsModal.tsx +++ b/src/components/projects/projectId/attributes/attributeId/ViewRecordDetailsModal.tsx @@ -4,7 +4,6 @@ import { ModalEnum } from "@/src/types/shared/modal"; import { useSelector } from "react-redux"; import style from '@/src/styles/components/projects/projectId/attribute-calculation.module.css'; import { RecordDisplay } from "@/src/components/shared/record-display/RecordDisplay"; -import { DataTypeEnum } from "@/src/types/shared/general"; import { ViewRecordDetailsModalProps } from "@/src/types/components/projects/projectId/settings/attribute-calculation"; import { selectVisibleAttributesHeuristics } from "@/src/reduxStore/states/pages/settings"; @@ -23,13 +22,9 @@ export default function ViewRecordDetailsModal(props: ViewRecordDetailsModalProp record={modalViewRecordDetails.record} />
Calculated value
- {props.currentAttribute.dataType != DataTypeEnum.EMBEDDING_LIST ? +
{props.sampleRecords[modalViewRecordDetails.recordIdx].calculatedValue.value} - :
- {props.sampleRecords[modalViewRecordDetails.recordIdx].calculatedValue.value.map((item: any) => - {item} - )} -
} +
diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index 48ed77ae..9e66e1aa 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -48,9 +48,15 @@ export default function DataBrowser() { refetchAttributesAndProcess(); refetchLabelingTasksAndProcess(); refetchEmbeddingsAndPostProcess(); - refetchUniqueValuesAndProcess(); }, [projectId, users, user]); + useEffect(() => { + if (!attributes || attributes.length == 0 || !projectId) return; + getUniqueValuesByAttributes(projectId, (res) => { + dispatch(setUniqueValuesDict(postProcessUniqueValues(res, attributes))); + }); + }, [attributes, projectId]); + useEffect(() => { if (!projectId || !labelingTasks || !recordList) return; refetchRecordCommentsAndProcess(recordList); @@ -140,12 +146,6 @@ export default function DataBrowser() { setSearchRequest({ offset: searchRequest.offset + searchRequest.limit, limit: searchRequest.limit }); } - function refetchUniqueValuesAndProcess() { - getUniqueValuesByAttributes(projectId, (res) => { - dispatch(setUniqueValuesDict(postProcessUniqueValues(res, attributes))); - }); - } - const setSearchRequestToInit = useCallback(() => { setSearchRequest(SEARCH_REQUEST); }, []); diff --git a/src/components/projects/projectId/data-browser/SearchGroups.tsx b/src/components/projects/projectId/data-browser/SearchGroups.tsx index 9c5a1b55..727fa106 100644 --- a/src/components/projects/projectId/data-browser/SearchGroups.tsx +++ b/src/components/projects/projectId/data-browser/SearchGroups.tsx @@ -29,6 +29,7 @@ import { getRecordsByStaticSlice, searchRecordsExtended } from "@/src/services/b import { staticDataSlicesCurrentCount } from "@/src/services/base/dataSlices"; import KernButton from "@/submodules/react-components/components/kern-button/KernButton"; import { MemoIconArrowDown, MemoIconArrowsRandom, MemoIconFilterOff, MemoIconPlus, MemoIconPointerOff, MemoIconTrash } from "@/submodules/react-components/components/kern-icons/icons"; +import { useConsoleLog } from "@/submodules/react-components/hooks/useConsoleLog"; const GROUP_SORT_ORDER = 0; let GLOBAL_SEARCH_GROUP_COUNT = 0; @@ -336,7 +337,14 @@ export default function SearchGroups() { const attributeName = formControlsIdx['name']; attributeType = getAttributeType(attributesSortOrder, attributeName); } - if (attributeType !== DataTypeEnum.BOOLEAN) { + if (attributeType == DataTypeEnum.TEXT_LIST) { + operatorsCopy.push({ + value: SearchOperator.CONTAINS.split("_").join(" "), + }); + tooltipsCopy.push(getSearchOperatorTooltip(SearchOperator.CONTAINS)); + formControlsIdx['operator'] = SearchOperator.CONTAINS; + + } else if (attributeType !== DataTypeEnum.BOOLEAN) { for (let t of Object.values(SearchOperator)) { operatorsCopy.push({ value: t.split("_").join(" "), @@ -357,6 +365,8 @@ export default function SearchGroups() { dispatch(setFullSearchStore(fullSearchCopy)); } + useConsoleLog(uniqueValuesDict, 'uniqueValuesDict'); + function removeSearchGroupItem(groupKey, index) { const fullSearchCopy = jsonCopy(fullSearchStore); fullSearchCopy[groupKey].groupElements.splice(index, 1); @@ -622,7 +632,7 @@ export default function SearchGroups() { }
- {uniqueValuesDict[groupItem['name']] && groupItem['operator'] != '' && groupItem['operator'] != 'BETWEEN' && groupItem['operator'] != 'IN' && groupItem['operator'] != 'IN WC' ? ( + {(uniqueValuesDict[groupItem['name']] && groupItem['operator'] != '' && groupItem['operator'] != 'BETWEEN' && groupItem['operator'] != 'IN' && groupItem['operator'] != 'IN WC' || saveAttributeType == DataTypeEnum.TEXT_LIST) ? (
selectValueDropdown(option, index, 'searchValue', group.key)} fontClass="font-dmMono" /> 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..20ad1403 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 @@ -176,9 +176,13 @@ 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) { + uniqueValuesDict[key] = uniqueValuesDict[key].map((value: string) => { + return JSON.parse(value); + })[0]; } } return uniqueValuesDict; From e6e734366727e2a71690f6f8d64b44769d0def7b Mon Sep 17 00:00:00 2001 From: Lina Date: Tue, 29 Jul 2025 14:53:02 +0200 Subject: [PATCH 05/11] Clear filter fix and equal operator --- .../projectId/data-browser/DataBrowser.tsx | 7 ++++-- .../data-browser/DataBrowserRecords.tsx | 2 +- .../data-browser/DataBrowserSidebar.tsx | 8 +++---- .../projectId/data-browser/SearchGroups.tsx | 24 +++++++++---------- .../settings/labeling-tasks/LabelingTasks.tsx | 1 - .../projectId/data-browser/data-browser.ts | 12 ++++++++++ .../data-browser/data-browser-helper.ts | 3 +-- .../data-browser/search-operators-helper.ts | 4 ++++ submodules/react-components | 2 +- 9 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index 9e66e1aa..2702ac34 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -21,10 +21,11 @@ import { getEmbeddings } from "@/src/services/base/embedding"; import { parseFilterToExtended } from "@/src/util/components/projects/projectId/data-browser/filter-parser-helper"; import { SearchGroup, Slice } from "@/submodules/javascript-functions/enums/enums"; import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants"; +import { DataBrowserProps } from "@/src/types/components/projects/projectId/data-browser/data-browser"; const SEARCH_REQUEST = { offset: 0, limit: 20 }; -export default function DataBrowser() { +export default function DataBrowser(props: DataBrowserProps) { const dispatch = useDispatch(); const projectId = useSelector(selectProjectId); @@ -40,6 +41,7 @@ export default function DataBrowser() { const activeSlice = useSelector(selectActiveSlice); const [searchRequest, setSearchRequest] = useState(SEARCH_REQUEST); + const [clearRequest, setClearRequest] = useState(false); useEffect(() => { if (!projectId) return; @@ -148,6 +150,7 @@ export default function DataBrowser() { const setSearchRequestToInit = useCallback(() => { setSearchRequest(SEARCH_REQUEST); + setClearRequest(true); }, []); const handleWebsocketNotification = useCallback((msgParts: string[]) => { @@ -171,7 +174,7 @@ export default function DataBrowser() { return (<> {projectId &&
- +
} ) diff --git a/src/components/projects/projectId/data-browser/DataBrowserRecords.tsx b/src/components/projects/projectId/data-browser/DataBrowserRecords.tsx index 674de9db..afc6393e 100644 --- a/src/components/projects/projectId/data-browser/DataBrowserRecords.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowserRecords.tsx @@ -1,5 +1,5 @@ import { openModal } from '@/src/reduxStore/states/modal'; -import { selectActiveSearchParams, selectActiveSlice, selectAdditionalData, selectRecords, selectSimilaritySearch, setActiveDataSlice, setActiveSearchParams, setIsTextHighlightNeeded, setRecordsInDisplay, setTextHighlight, updateAdditionalDataState } from '@/src/reduxStore/states/pages/data-browser'; +import { selectActiveSearchParams, selectActiveSlice, selectAdditionalData, selectRecords, selectSimilaritySearch, setActiveDataSlice, setActiveSearchParams, setFullSearchStore, setIsTextHighlightNeeded, setRecordsInDisplay, setTextHighlight, updateAdditionalDataState } from '@/src/reduxStore/states/pages/data-browser'; import style from '@/src/styles/components/projects/projectId/data-browser.module.css'; import { ModalEnum } from '@/src/types/shared/modal'; import { TOOLTIPS_DICT } from '@/src/util/tooltip-constants'; diff --git a/src/components/projects/projectId/data-browser/DataBrowserSidebar.tsx b/src/components/projects/projectId/data-browser/DataBrowserSidebar.tsx index 183c8bac..6ffeea16 100644 --- a/src/components/projects/projectId/data-browser/DataBrowserSidebar.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowserSidebar.tsx @@ -1,9 +1,9 @@ import { selectAllUsers } from '@/src/reduxStore/states/general'; import { setModalStates } from '@/src/reduxStore/states/modal'; -import { selectActiveSlice, selectAdditionalData, selectDataSlicesAll, setActiveDataSlice, setActiveSearchParams, setFullSearchStore, setIsTextHighlightNeeded, setRecordsInDisplay, setTextHighlight, updateAdditionalDataState } from '@/src/reduxStore/states/pages/data-browser'; +import { selectActiveSlice, selectAdditionalData, selectDataSlicesAll, setActiveDataSlice, setActiveSearchParams, setFullSearchStore, setIsTextHighlightNeeded, setRecordsInDisplay, setTextHighlight, setUniqueValuesDict, updateAdditionalDataState } from '@/src/reduxStore/states/pages/data-browser'; import { selectProjectId } from '@/src/reduxStore/states/project'; import style from '@/src/styles/components/projects/projectId/data-browser.module.css'; -import { DataSlice } from '@/src/types/components/projects/projectId/data-browser/data-browser'; +import { DataBrowserSidebarProps, DataSlice } from '@/src/types/components/projects/projectId/data-browser/data-browser'; import { ModalEnum } from '@/src/types/shared/modal'; import { updateSliceInfoHelper } from '@/src/util/components/projects/projectId/data-browser/data-browser-helper'; import { Slice } from '@/submodules/javascript-functions/enums/enums'; @@ -17,7 +17,7 @@ import DataSliceInfoModal from './modals/DataSliceInfoModal'; import MultilineTooltip from '@/src/components/shared/multilines-tooltip/MultilineTooltip'; import { MemoIconAlertTriangle, MemoIconInfoCircle, MemoIconLayoutSidebar, MemoIconTrash } from '@/submodules/react-components/components/kern-icons/icons'; -export default function DataBrowserSidebar() { +export default function DataBrowserSidebar(props: DataBrowserSidebarProps) { const dispatch = useDispatch(); const projectId = useSelector(selectProjectId); @@ -130,7 +130,7 @@ export default function DataBrowserSidebar() {
You can filter and order all your data in the browser according to your needs. Selected filter criteria can be saved and used later on. - +
}
diff --git a/src/components/projects/projectId/data-browser/SearchGroups.tsx b/src/components/projects/projectId/data-browser/SearchGroups.tsx index 727fa106..384f8b5d 100644 --- a/src/components/projects/projectId/data-browser/SearchGroups.tsx +++ b/src/components/projects/projectId/data-browser/SearchGroups.tsx @@ -29,12 +29,12 @@ import { getRecordsByStaticSlice, searchRecordsExtended } from "@/src/services/b import { staticDataSlicesCurrentCount } from "@/src/services/base/dataSlices"; import KernButton from "@/submodules/react-components/components/kern-button/KernButton"; import { MemoIconArrowDown, MemoIconArrowsRandom, MemoIconFilterOff, MemoIconPlus, MemoIconPointerOff, MemoIconTrash } from "@/submodules/react-components/components/kern-icons/icons"; -import { useConsoleLog } from "@/submodules/react-components/hooks/useConsoleLog"; +import { SearchGroupsProps } from "@/src/types/components/projects/projectId/data-browser/data-browser"; const GROUP_SORT_ORDER = 0; let GLOBAL_SEARCH_GROUP_COUNT = 0; -export default function SearchGroups() { +export default function SearchGroups(props: SearchGroupsProps) { const dispatch = useDispatch(); const projectId = useSelector(selectProjectId); @@ -97,7 +97,7 @@ export default function SearchGroups() { }); setBackgroundColors(colors); setAttributeSortOrder(attributesSort); - }, [attributes]); + }, [attributes, props.clearRequest]); useEffect(() => { if (!attributesSortOrder || !searchGroupsStore) return; @@ -339,10 +339,10 @@ export default function SearchGroups() { } if (attributeType == DataTypeEnum.TEXT_LIST) { operatorsCopy.push({ - value: SearchOperator.CONTAINS.split("_").join(" "), + value: SearchOperator.EQUAL.split("_").join(" "), }); - tooltipsCopy.push(getSearchOperatorTooltip(SearchOperator.CONTAINS)); - formControlsIdx['operator'] = SearchOperator.CONTAINS; + tooltipsCopy.push(getSearchOperatorTooltip(SearchOperator.EQUAL)); + formControlsIdx['operator'] = SearchOperator.EQUAL; } else if (attributeType !== DataTypeEnum.BOOLEAN) { for (let t of Object.values(SearchOperator)) { @@ -365,8 +365,6 @@ export default function SearchGroups() { dispatch(setFullSearchStore(fullSearchCopy)); } - useConsoleLog(uniqueValuesDict, 'uniqueValuesDict'); - function removeSearchGroupItem(groupKey, index) { const fullSearchCopy = jsonCopy(fullSearchStore); fullSearchCopy[groupKey].groupElements.splice(index, 1); @@ -622,17 +620,17 @@ export default function SearchGroups() {
- selectValueDropdown(option.name, index, 'name', group.key)} fontClass="font-dmMono" buttonClasses="text-xs" /> + {attributesSortOrder && selectValueDropdown(option.name, index, 'name', group.key)} fontClass="font-dmMono" buttonClasses="text-xs" />}
- {groupItem.operator != '' && + {(groupItem.operator != '' && operatorsDropdown) && selectValueDropdown(option.value, index, 'operator', group.key)} fontClass="font-dmMono" /> }
- {(uniqueValuesDict[groupItem['name']] && groupItem['operator'] != '' && groupItem['operator'] != 'BETWEEN' && groupItem['operator'] != 'IN' && groupItem['operator'] != 'IN WC' || saveAttributeType == DataTypeEnum.TEXT_LIST) ? ( + {(uniqueValuesDict && uniqueValuesDict[groupItem['name']] && groupItem['operator'] != '' && groupItem['operator'] != 'BETWEEN' && groupItem['operator'] != 'IN' && groupItem['operator'] != 'IN WC' || saveAttributeType == DataTypeEnum.TEXT_LIST) ? (
selectValueDropdown(option, index, 'searchValue', group.key)} fontClass="font-dmMono" /> @@ -651,7 +649,7 @@ export default function SearchGroups() {
)} - {(groupItem['operator'] == "BEGINS WITH" || groupItem['operator'] == "ENDS WITH" || groupItem['operator'] == SearchOperator.CONTAINS || groupItem['operator'] == "IN WC") && (saveAttributeType != DataTypeEnum.INTEGER && saveAttributeType != DataTypeEnum.FLOAT) && + {(groupItem['operator'] == "BEGINS WITH" || groupItem['operator'] == "ENDS WITH" || groupItem['operator'] == SearchOperator.CONTAINS || groupItem['operator'] == "IN WC") && (saveAttributeType != DataTypeEnum.INTEGER && saveAttributeType != DataTypeEnum.FLOAT && saveAttributeType != DataTypeEnum.TEXT_LIST) && } diff --git a/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx b/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx index ff5fad1d..d1025343 100644 --- a/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx +++ b/src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx @@ -20,7 +20,6 @@ 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"; export default function LabelingTasks() { const dispatch = useDispatch(); diff --git a/src/types/components/projects/projectId/data-browser/data-browser.ts b/src/types/components/projects/projectId/data-browser/data-browser.ts index a8e15e78..8c863ed9 100644 --- a/src/types/components/projects/projectId/data-browser/data-browser.ts +++ b/src/types/components/projects/projectId/data-browser/data-browser.ts @@ -55,4 +55,16 @@ export enum LineBreaksType { export type DataBrowserRecordsProps = { refetchNextRecords: () => void; clearSearchRequest: () => void; +}; + +export type DataBrowserProps = { + clearSearchRequest: () => void; +}; + +export type DataBrowserSidebarProps = { + clearRequest: boolean; +} + +export type SearchGroupsProps = { + clearRequest: boolean; }; \ No newline at end of file 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 20ad1403..c6d1c3a5 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); 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..2c7e4ec2 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; @@ -134,6 +135,9 @@ export function prepareOperator(searchElement: any, attributeType: string): stri if (attributeType == "BOOLEAN") { return SearchOperator.EQUAL; } else { + if (attributeType == DataTypeEnum.TEXT_LIST && searchElement.values.operator == SearchOperator.EQUAL) { + return SearchOperator.CONTAINS; + } return searchElement.values.operator; } } \ No newline at end of file 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 From 5ced565e4581e124536277b7863942dd8fe99d30 Mon Sep 17 00:00:00 2001 From: Lina Date: Tue, 29 Jul 2025 16:11:36 +0200 Subject: [PATCH 06/11] Similary search, evalutation changes for the new attribute type --- .../data-browser/modals/SimilaritySeachModal.tsx | 9 +++++++-- .../projects/projectId/edit-records/EditField.tsx | 2 +- .../projects/projectId/edit-records/EditRecords.tsx | 2 +- .../playground/PlaygroundSearchMetaFilterModal.tsx | 11 ++++++++--- .../settings/embeddings/AddNewEmbeddingModal.tsx | 2 +- .../projectId/data-browser/search-groups-helper.ts | 6 ++++-- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx b/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx index 16d1cae1..7a759776 100644 --- a/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx +++ b/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx @@ -95,8 +95,13 @@ export default function SimilaritySearchModal() { filterAttributesSS.forEach((attribute: string) => { const attributeType = attributes.find(att => att.name == attribute)?.dataType if (attributeType !== DataTypeEnum.INTEGER) { - operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN); - tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN)); + if (attributeType == DataTypeEnum.TEXT_LIST) { + operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN && operator !== FilterIntegrationOperator.IN); + tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN) && tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.IN)); + } else { + operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN); + tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN)); + } } operatorsCopy[attribute] = operators; tooltipsCopy[attribute] = tooltips; diff --git a/src/components/projects/projectId/edit-records/EditField.tsx b/src/components/projects/projectId/edit-records/EditField.tsx index 94cfd4e8..f7ebe1cf 100644 --- a/src/components/projects/projectId/edit-records/EditField.tsx +++ b/src/components/projects/projectId/edit-records/EditField.tsx @@ -114,7 +114,7 @@ export default function EditField(props: EditFieldProps) { type="checkbox" className="w-6 " />} - {props.attribute.dataType == DataTypeEnum.EMBEDDING_LIST && + {(props.attribute.dataType == DataTypeEnum.EMBEDDING_LIST || props.attribute.dataType == DataTypeEnum.TEXT_LIST) &&