|
1 | 1 | import { Box, Typography, TextLink, Flex, Tabs, LoadingSpinner } from '@neo4j-ndl/react'; |
2 | 2 | import { DocumentTextIconOutline } from '@neo4j-ndl/react/icons'; |
3 | | -import '../../../styling/info.css'; |
4 | | -import Neo4jRetrievalLogo from '../../../assets/images/Neo4jRetrievalLogo.png'; |
5 | | -import wikipedialogo from '../../../assets/images/wikipedia.svg'; |
6 | | -import youtubelogo from '../../../assets/images/youtube.svg'; |
7 | | -import gcslogo from '../../../assets/images/gcs.webp'; |
8 | | -import s3logo from '../../../assets/images/s3logo.png'; |
9 | | -import { Chunk, Entity, GroupedEntity, UserCredentials, chatInfoMessage } from '../../../types'; |
| 3 | +import '../../styling/info.css'; |
| 4 | +import Neo4jRetrievalLogo from '../../assets/images/Neo4jRetrievalLogo.png'; |
| 5 | +import wikipedialogo from '../../assets/images/wikipedia.svg'; |
| 6 | +import youtubelogo from '../../assets/images/youtube.svg'; |
| 7 | +import gcslogo from '../../assets/images/gcs.webp'; |
| 8 | +import s3logo from '../../assets/images/s3logo.png'; |
| 9 | +import { Chunk, Entity, GroupedEntity, UserCredentials, chatInfoMessage } from '../../types'; |
10 | 10 | import { useEffect, useMemo, useState } from 'react'; |
11 | | -import HoverableLink from '../../UI/HoverableLink'; |
12 | | -import GraphViewButton from '../../Graph/GraphViewButton'; |
13 | | -import { chunkEntitiesAPI } from '../../../services/ChunkEntitiesInfo'; |
14 | | -import { useCredentials } from '../../../context/UserCredentials'; |
| 11 | +import HoverableLink from '../UI/HoverableLink'; |
| 12 | +import GraphViewButton from '../Graph/GraphViewButton'; |
| 13 | +import { chunkEntitiesAPI } from '../../services/ChunkEntitiesInfo'; |
| 14 | +import { useCredentials } from '../../context/UserCredentials'; |
15 | 15 | import type { Node, Relationship } from '@neo4j-nvl/base'; |
16 | 16 | import { calcWordColor } from '@neo4j-devtools/word-color'; |
17 | 17 | import ReactMarkdown from 'react-markdown'; |
18 | 18 | import { GlobeAltIconOutline } from '@neo4j-ndl/react/icons'; |
19 | | -import { youtubeLinkValidation } from '../../../utils/Utils'; |
20 | | -const InfoModal: React.FC<chatInfoMessage> = ({ sources, model, total_tokens, response_time, chunk_ids }) => { |
| 19 | +import { youtubeLinkValidation } from '../../utils/Utils'; |
| 20 | + |
| 21 | +const ChatInfoModal: React.FC<chatInfoMessage> = ({ sources, model, total_tokens, response_time, chunk_ids, mode }) => { |
21 | 22 | const [activeTab, setActiveTab] = useState<number>(3); |
22 | 23 | const [infoEntities, setInfoEntities] = useState<Entity[]>([]); |
23 | 24 | const [loading, setLoading] = useState<boolean>(false); |
@@ -98,15 +99,16 @@ const InfoModal: React.FC<chatInfoMessage> = ({ sources, model, total_tokens, re |
98 | 99 | <Box className='flex flex-col'> |
99 | 100 | <Typography variant='h2'>Retrieval information</Typography> |
100 | 101 | <Typography variant='body-medium' className='mb-2'> |
101 | | - To generate this response, in <span className='font-bold'>{response_time} seconds</span> we used{' '} |
102 | | - <span className='font-bold'>{total_tokens}</span> tokens with the model{' '} |
103 | | - <span className='font-bold'>{model}</span>. |
| 102 | + To generate this response, the process took <span className='font-bold'>{response_time} seconds,</span>{' '} |
| 103 | + utilizing <span className='font-bold'>{total_tokens}</span> tokens with the model{' '} |
| 104 | + <span className='font-bold'>{model}</span> in{' '} |
| 105 | + <span className='font-bold'>{mode !== 'vector' ? mode.replace(/\+/g, ' & ') : mode}</span> mode. |
104 | 106 | </Typography> |
105 | 107 | </Box> |
106 | 108 | </Box> |
107 | 109 | <Tabs size='large' fill='underline' onChange={onChangeTabs} value={activeTab}> |
108 | 110 | <Tabs.Tab tabId={3}>Sources used</Tabs.Tab> |
109 | | - <Tabs.Tab tabId={4}>Top Entities used</Tabs.Tab> |
| 111 | + {mode === 'graph+vector' && <Tabs.Tab tabId={4}>Top Entities used</Tabs.Tab>} |
110 | 112 | <Tabs.Tab tabId={5}>Chunks</Tabs.Tab> |
111 | 113 | </Tabs> |
112 | 114 | <Flex className='p-4'> |
@@ -349,4 +351,4 @@ const InfoModal: React.FC<chatInfoMessage> = ({ sources, model, total_tokens, re |
349 | 351 | </Box> |
350 | 352 | ); |
351 | 353 | }; |
352 | | -export default InfoModal; |
| 354 | +export default ChatInfoModal; |
0 commit comments