Skip to content

Commit f6da71b

Browse files
Added the tooltip for disabled llm option (#835)
1 parent 66025bc commit f6da71b

File tree

14 files changed

+114
-99
lines changed

14 files changed

+114
-99
lines changed

frontend/src/components/ChatBot/ChatInfoModal.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,12 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
261261
To generate this response, the process took <span className='font-bold'>{response_time} seconds,</span>
262262
utilizing <span className='font-bold'>{total_tokens}</span> tokens with the model{' '}
263263
<span className='font-bold'>{model}</span> in{' '}
264-
<span className='font-bold'>{chatModeReadableLables[mode] !== 'vector' ? chatModeReadableLables[mode].replace(/\+/g, ' & ') : chatModeReadableLables[mode]}</span> mode.
264+
<span className='font-bold'>
265+
{chatModeReadableLables[mode] !== 'vector'
266+
? chatModeReadableLables[mode].replace(/\+/g, ' & ')
267+
: chatModeReadableLables[mode]}
268+
</span>{' '}
269+
mode.
265270
</Typography>
266271
</Box>
267272
</Box>

frontend/src/components/ChatBot/ChatModeToggle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export default function ChatModeToggle({
3838
)
3939
);
4040
}
41-
if (!(chatModes.includes(chatModeLables.vector) || chatModes.includes(chatModeLables['graph+vector']))) {
42-
setchatModes([chatModeLables['graph+vector']]);
41+
if (!chatModes.includes(chatModeLables.vector)) {
42+
setchatModes([chatModeLables.vector]);
4343
}
4444
}
4545
}, [selectedRows.length, chatModes.length]);

frontend/src/components/ChatBot/ChatModesSwitch.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export default function ChatModesSwitch({
1717
currentMode: string;
1818
isFullScreen: boolean;
1919
}) {
20-
const chatmodetoshow =chatModeReadableLables[currentMode].includes('+') ? capitalizeWithPlus(chatModeReadableLables[currentMode]) : capitalize(chatModeReadableLables[currentMode]);
20+
const chatmodetoshow = chatModeReadableLables[currentMode].includes('+')
21+
? capitalizeWithPlus(chatModeReadableLables[currentMode])
22+
: capitalize(chatModeReadableLables[currentMode]);
2123
return (
2224
<Flex flexDirection='row' gap='1' alignItems='center'>
2325
<IconButton

frontend/src/components/ChatBot/ChunkInfo.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
7474
label='Graph view'
7575
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
7676
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
77-
>{'View Graph'}
77+
>
78+
{'View Graph'}
7879
</TextLink>
7980
</div>
8081
</>
@@ -98,11 +99,12 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
9899
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
99100
<div>
100101
<TextLink
101-
as='small'
102-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
102+
as='small'
103+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
103104
label='Graph view'
104105
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
105-
>{'View Graph'}
106+
>
107+
{'View Graph'}
106108
</TextLink>
107109
</div>
108110
</>
@@ -121,10 +123,11 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
121123
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
122124
<div>
123125
<TextLink
124-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
126+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
125127
label='Graph view'
126128
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
127-
>{'View Graph'}
129+
>
130+
{'View Graph'}
128131
</TextLink>
129132
</div>
130133
</>
@@ -143,10 +146,11 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
143146
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
144147
<div>
145148
<TextLink
146-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
149+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
147150
label='Graph view'
148151
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
149-
>{'View Graph'}
152+
>
153+
{'View Graph'}
150154
</TextLink>
151155
</div>
152156
</>
@@ -165,10 +169,11 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
165169
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
166170
<div>
167171
<TextLink
168-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
172+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
169173
label='Graph view'
170174
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
171-
>{'View Graph'}
175+
>
176+
{'View Graph'}
172177
</TextLink>
173178
</div>
174179
</>
@@ -191,10 +196,11 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
191196
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
192197
<div>
193198
<TextLink
194-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
199+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
195200
label='Graph view'
196201
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
197-
>{'View Graph'}
202+
>
203+
{'View Graph'}
198204
</TextLink>
199205
</div>
200206
</>
@@ -222,10 +228,11 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
222228
</Typography>
223229
<div>
224230
<TextLink
225-
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
231+
className={`${loadingGraphView ? 'cursor-wait' : 'cursor-pointer'}`}
226232
label='Graph view'
227233
onClick={() => handleChunkClick(chunk.element_id, 'Chunk')}
228-
>{'View Graph'}
234+
>
235+
{'View Graph'}
229236
</TextLink>
230237
</div>
231238
</>

frontend/src/components/Content.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ const Content: React.FC<ContentProps> = ({
527527
const handleOpenGraphClick = () => {
528528
const bloomUrl = process.env.VITE_BLOOM_URL;
529529
const uriCoded = userCredentials?.uri.replace(/:\d+$/, '');
530-
const connectURL = `${uriCoded?.split('//')[0]}//${userCredentials?.userName}@${uriCoded?.split('//')[1]}:${userCredentials?.port ?? '7687'
531-
}`;
530+
const connectURL = `${uriCoded?.split('//')[0]}//${userCredentials?.userName}@${uriCoded?.split('//')[1]}:${
531+
userCredentials?.port ?? '7687'
532+
}`;
532533
const encodedURL = encodeURIComponent(connectURL);
533534
const replacedUrl = bloomUrl?.replace('{CONNECT_URL}', encodedURL);
534535
window.open(replacedUrl, '_blank');
@@ -538,10 +539,10 @@ const Content: React.FC<ContentProps> = ({
538539
isLeftExpanded && isRightExpanded
539540
? 'contentWithExpansion'
540541
: isRightExpanded
541-
? 'contentWithChatBot'
542-
: !isLeftExpanded && !isRightExpanded
543-
? 'w-[calc(100%-128px)]'
544-
: 'contentWithDropzoneExpansion';
542+
? 'contentWithChatBot'
543+
: !isLeftExpanded && !isRightExpanded
544+
? 'w-[calc(100%-128px)]'
545+
: 'contentWithDropzoneExpansion';
545546

546547
const handleGraphView = () => {
547548
setOpenGraphView(true);
@@ -848,8 +849,9 @@ const Content: React.FC<ContentProps> = ({
848849
handleGenerateGraph={processWaitingFilesOnRefresh}
849850
></FileTable>
850851
<Flex
851-
className={`${!isLeftExpanded && !isRightExpanded ? 'w-[calc(100%-128px)]' : 'w-full'
852-
} p-2.5 absolute bottom-4 mt-1.5 self-start`}
852+
className={`${
853+
!isLeftExpanded && !isRightExpanded ? 'w-[calc(100%-128px)]' : 'w-full'
854+
} p-2.5 absolute bottom-4 mt-1.5 self-start`}
853855
justifyContent='space-between'
854856
flexDirection={isTablet ? 'column' : 'row'}
855857
>

frontend/src/components/DataSources/AWS/S3Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const S3Modal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
8585
name: item.fileName,
8686
size: item.fileSize,
8787
sourceUrl: item.url,
88-
uploadProgress:100,
88+
uploadProgress: 100,
8989
// total_pages: 'N/A',
9090
id: uuidv4(),
9191
...defaultValues,
@@ -102,7 +102,7 @@ const S3Modal: React.FC<S3ModalProps> = ({ hideModal, open }) => {
102102
model: defaultValues.model,
103103
fileSource: defaultValues.fileSource,
104104
processingProgress: defaultValues.processingProgress,
105-
uploadProgress:100,
105+
uploadProgress: 100,
106106
});
107107
}
108108
});

frontend/src/components/DataSources/GCS/GCSModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const GCSModal: React.FC<GCSModalProps> = ({ hideModal, open, openGCSModal }) =>
105105
id: uuidv4(),
106106
accessToken: codeResponse.access_token,
107107
...defaultValues,
108-
uploadProgress:100
108+
uploadProgress: 100,
109109
});
110110
} else {
111111
const tempFileData = copiedFilesData[filedataIndex];
@@ -120,7 +120,7 @@ const GCSModal: React.FC<GCSModalProps> = ({ hideModal, open, openGCSModal }) =>
120120
fileSource: defaultValues.fileSource,
121121
processingProgress: defaultValues.processingProgress,
122122
accessToken: codeResponse.access_token,
123-
uploadProgress:100
123+
uploadProgress: 100,
124124
});
125125
}
126126
}

frontend/src/components/Dropdown.tsx

Lines changed: 43 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Dropdown, Tip } from '@neo4j-ndl/react';
1+
import { Dropdown, Tip, useMediaQuery } from '@neo4j-ndl/react';
22
import { OptionType, ReusableDropdownProps } from '../types';
3-
import { memo, useMemo, useReducer } from 'react';
3+
import { memo, useMemo } from 'react';
44
import { capitalize, capitalizeWithUnderscore } from '../utils/Utils';
5-
// import { LLMDropdownLabel } from '../utils/Constants';
5+
import { prodllms } from '../utils/Constants';
6+
67
const DropdownComponent: React.FC<ReusableDropdownProps> = ({
78
options,
89
placeholder,
@@ -13,64 +14,55 @@ const DropdownComponent: React.FC<ReusableDropdownProps> = ({
1314
isDisabled,
1415
value,
1516
}) => {
16-
const [disableTooltip, toggleDisableState] = useReducer((state) => !state, false);
1717
const isProdEnv = process.env.VITE_ENV === 'PROD';
18-
const supportedModels = process.env.VITE_LLM_MODELS_PROD;
18+
const isLargeDesktop = useMediaQuery(`(min-width:1440px )`);
1919
const handleChange = (selectedOption: OptionType | null | void) => {
2020
onSelect(selectedOption);
2121
};
2222
const allOptions = useMemo(() => options, [options]);
2323
return (
2424
<>
2525
<div className={view === 'ContentView' ? 'w-[150px]' : ''}>
26-
<Tip allowedPlacements={['top']} isDisabled={disableTooltip}>
27-
<Tip.Trigger>
28-
<Dropdown
29-
type='select'
30-
aria-label='A selection dropdown'
31-
label='LLM Models'
32-
selectProps={{
33-
onChange: handleChange,
34-
options: allOptions?.map((option) => {
35-
const label =
36-
typeof option === 'string' ? capitalizeWithUnderscore(option) : capitalize(option.label);
37-
const value = typeof option === 'string' ? option : option.value;
38-
const isModelSupported = !isProdEnv || supportedModels?.includes(value);
39-
return {
40-
label,
41-
value,
42-
isDisabled: !isModelSupported,
43-
};
44-
}),
45-
placeholder: placeholder || 'Select an option',
46-
defaultValue: defaultValue
47-
? { label: capitalizeWithUnderscore(defaultValue), value: defaultValue }
48-
: undefined,
49-
menuPlacement: 'auto',
50-
isDisabled: isDisabled,
51-
value: value,
52-
onMenuOpen: () => {
53-
toggleDisableState();
54-
},
55-
onMenuClose: () => {
56-
toggleDisableState();
57-
},
58-
}}
59-
size='medium'
60-
fluid
61-
/>
62-
</Tip.Trigger>
63-
<Tip.Content>LLM Model used for Extraction & Chat</Tip.Content>
64-
</Tip>
26+
<Dropdown
27+
type='select'
28+
aria-label='A selection dropdown'
29+
label='LLM Models'
30+
helpText={<div className='!w-max'> LLM Model used for Extraction & Chat</div>}
31+
selectProps={{
32+
onChange: handleChange,
33+
// @ts-ignore
34+
options: allOptions?.map((option) => {
35+
const label = typeof option === 'string' ? capitalizeWithUnderscore(option) : capitalize(option.label);
36+
const value = typeof option === 'string' ? option : option.value;
37+
const isModelSupported = !isProdEnv || prodllms?.includes(value);
38+
return {
39+
label: !isModelSupported ? (
40+
<Tip allowedPlacements={isLargeDesktop ? ['left'] : ['right']}>
41+
<Tip.Trigger>
42+
<span>{label}</span>
43+
</Tip.Trigger>
44+
<Tip.Content>Available In Development Version</Tip.Content>
45+
</Tip>
46+
) : (
47+
<span>{label}</span>
48+
),
49+
value,
50+
isDisabled: !isModelSupported,
51+
};
52+
}),
53+
placeholder: placeholder || 'Select an option',
54+
defaultValue: defaultValue
55+
? { label: capitalizeWithUnderscore(defaultValue), value: defaultValue }
56+
: undefined,
57+
menuPlacement: 'auto',
58+
isDisabled: isDisabled,
59+
value: value,
60+
}}
61+
size='medium'
62+
fluid
63+
/>
6564
{children}
6665
</div>
67-
{/* {isProdEnv && (<Typography className={'pt-4 absolute top-14 self-start'} variant='body-small'>
68-
{LLMDropdownLabel.disabledModels}
69-
<a href="https://dev-frontend-dcavk67s4a-uc.a.run.app/" target="_blank" style={{ textDecoration: 'underline' }}>
70-
{LLMDropdownLabel.devEnv}
71-
</a>
72-
{'.'}
73-
</Typography>)} */}
7466
</>
7567
);
7668
};

frontend/src/components/FileTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
522522
disabled={info.getValue() === 'Uploading'}
523523
clean
524524
onClick={() => {
525-
const copied={...info.row.original};
525+
const copied = { ...info.row.original };
526526
delete copied.accessToken;
527527
handleCopy(copied);
528528
}}

frontend/src/components/Popups/GraphEnhancementDialog/Deduplication/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export default function DeduplicationTab() {
5656
}
5757
if (duplicateNodesData.data.data.length) {
5858
setDuplicateNodes(duplicateNodesData.data.data);
59-
//@ts-ignore
60-
setNodesCount(duplicateNodesData.data.message.total)
59+
// @ts-ignore
60+
setNodesCount(duplicateNodesData.data.message.total);
6161
} else {
6262
setDuplicateNodes([]);
6363
}

0 commit comments

Comments
 (0)