Skip to content

Commit 43662d3

Browse files
committed
Disables switch to llm attribute due to differen code structure
1 parent 55d9755 commit 43662d3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Editor } from "@monaco-editor/react";
1111
import { Tooltip } from "@nextui-org/react";
1212
import { IconAlertTriangleFilled, IconArrowLeft, IconCircleCheckFilled } from "@tabler/icons-react";
1313
import { useRouter } from "next/router";
14-
import { useCallback, useEffect, useState } from "react";
14+
import { useCallback, useEffect, useMemo, useState } from "react";
1515
import { useDispatch, useSelector } from "react-redux"
1616
import ExecutionContainer from "./ExecutionContainer";
1717
import { getPythonFunctionRegExMatch, toPythonFunctionName } from "@/submodules/javascript-functions/python-functions-parser";
@@ -305,6 +305,11 @@ export default function AttributeCalculation() {
305305
const orgId = useSelector(selectOrganizationId);
306306
useWebsocket(orgId, Application.REFINERY, CurrentPage.ATTRIBUTE_CALCULATION, handleWebsocketNotification, projectId);
307307

308+
const disabledOptions = useMemo(() => {
309+
if (!currentAttribute || currentAttribute.dataType == DataTypeEnum.LLM_RESPONSE) return undefined;
310+
return DATA_TYPES.map((e) => e.value == DataTypeEnum.LLM_RESPONSE);
311+
}, [currentAttribute?.dataType])
312+
308313
return (projectId && <div className={`bg-white p-4 overflow-y-auto min-h-full h-[calc(100vh-4rem)]`} onScroll={(e: any) => onScrollEvent(e)}>
309314
{currentAttribute && <div>
310315
<div className={`sticky z-50 h-12 ${isHeaderNormal ? 'top-1' : '-top-5'}`}>
@@ -350,7 +355,7 @@ export default function AttributeCalculation() {
350355
<div className="flex flex-row items-center">
351356
<Tooltip color="invert" placement="right" content={currentAttribute.state == AttributeState.USABLE || currentAttribute.state == AttributeState.RUNNING ? TOOLTIPS_DICT.ATTRIBUTE_CALCULATION.CANNOT_EDIT_DATATYPE : TOOLTIPS_DICT.ATTRIBUTE_CALCULATION.EDIT_DATATYPE}>
352357
<KernDropdown buttonName={currentAttribute.dataTypeName} options={DATA_TYPES} dropdownWidth="w-52"
353-
selectedOption={(option: any) => updateDataType(option)} disabled={currentAttribute.state == AttributeState.USABLE} dropdownClasses="z-30" />
358+
selectedOption={(option: any) => updateDataType(option)} disabledOptions={disabledOptions} disabled={currentAttribute.state == AttributeState.USABLE} dropdownClasses="z-30" />
354359
</Tooltip>
355360
{currentAttribute.dataType == DataTypeEnum.EMBEDDING_LIST && <div className="text-gray-700 text-sm ml-3">Only useable for similarity search</div>}
356361
{currentAttribute.dataType == DataTypeEnum.LLM_RESPONSE && <div className="ml-3 flex flex-row flex-nowrap w-full items-center gap-x-2">

0 commit comments

Comments
 (0)