Skip to content

Tooltip and other UI fixes #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ If none of the mode is mentioned in the chat modes variable all modes will be av
CHAT_MODES=""
```

If however you want to specifiy the only vector mode or only graph mode you can do that by specifying the mode in the env:
If however you want to specify the only vector mode or only graph mode you can do that by specifying the mode in the env:
```env
CHAT_MODES="vector,graph+vector"
```
Expand Down Expand Up @@ -154,12 +154,7 @@ Allow unauthenticated request : Yes
| GOOGLE_CLIENT_ID | Optional | | Client ID for Google authentication |
| GCS_FILE_CACHE | Optional | False | If set to True, will save the files to process into GCS. If set to False, will save the files locally |
| ENTITY_EMBEDDING | Optional | False | If set to True, It will add embeddings for each entity in database |
| LLM_MODEL_CONFIG_azure_ai_<azure_deployment_name> | Optional | | Set azure config as - azure_deployment_name,azure_endpoint or base_url,azure_api_key,api_version|
| LLM_MODEL_CONFIG_groq_<model_name> | Optional | | Set groq config as - model_name,base_url,groq_api_key |
| LLM_MODEL_CONFIG_anthropic_<model_name> | Optional | | Set anthropic config as - model_name,anthropic_api_key |
| LLM_MODEL_CONFIG_fireworks_<model_name> | Optional | | Set fireworks config as - model_name,fireworks_api_key |
| LLM_MODEL_CONFIG_bedrock_<model_name> | Optional | | Set bedrock config as - model_name,aws_access_key_id,aws_secret__access_key,region_name |
| LLM_MODEL_CONFIG_ollama_<model_name> | Optional | | Set ollama config as - model_name,model_local_url |
| LLM_MODEL_CONFIG_ollama_<model_name> | Optional | | Set ollama config as - model_name,model_local_url for local deployments |



Expand Down Expand Up @@ -187,4 +182,4 @@ Allow unauthenticated request : Yes
For any inquiries or support, feel free to raise [Github Issue](https://github.com/neo4j-labs/llm-graph-builder/issues)


## Happy Graph Building!
## Happy Graph Building!
1 change: 0 additions & 1 deletion backend/src/graphDB_dataAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def delete_file_from_graph(self, filenames, source_types, deleteEntities:str, me
else :
result = self.execute_query(query_to_delete_document, param)
logging.info(f"Deleting {len(filename_list)} documents = '{filename_list}' from '{source_types_list}' with their entities from database")

return result, len(filename_list)

def list_unconnected_nodes(self):
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,13 @@
margin-bottom: 0 !important;
}

.node_label__value-container--has-value {
.node_label__value-container--has-value ,.relationship_label__value-container--has-value{
max-height: 215px;
overflow-y: scroll !important;
scrollbar-width: thin;
}

.relationship_label__value-container--has-value {
max-height: 215px;
.entity_extraction_Tab_node_label__value-container--has-value,.entity_extraction_Tab_relationship_label__value-container--has-value{
max-height: 100px;
overflow-y: scroll !important;
scrollbar-width: thin
}
scrollbar-width: thin;
}
11 changes: 11 additions & 0 deletions frontend/src/assets/images/web-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 34 additions & 24 deletions frontend/src/components/ChatBot/ChatInfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CypherCodeBlock,
CypherCodeBlockProps,
useCopyToClipboard,
Banner,
} from '@neo4j-ndl/react';
import { DocumentDuplicateIconOutline, DocumentTextIconOutline } from '@neo4j-ndl/react/icons';
import '../../styling/info.css';
Expand Down Expand Up @@ -39,8 +40,9 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
mode,
cypher_query,
graphonly_entities,
error,
}) => {
const [activeTab, setActiveTab] = useState<number>(mode === 'graph' ? 4 : 3);
const [activeTab, setActiveTab] = useState<number>(error.length ? 10 : mode === 'graph' ? 4 : 3);
const [infoEntities, setInfoEntities] = useState<Entity[]>([]);
const [loading, setLoading] = useState<boolean>(false);
const { userCredentials } = useCredentials();
Expand Down Expand Up @@ -80,7 +82,7 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
[copiedText, cypher_query]
);
useEffect(() => {
if (mode != 'graph') {
if (mode != 'graph' || error?.trim() !== '') {
setLoading(true);
chunkEntitiesAPI(userCredentials as UserCredentials, chunk_ids.map((c) => c.id).join(','))
.then((response) => {
Expand All @@ -107,7 +109,7 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
() => {
setcopiedText(false);
};
}, [chunk_ids, mode]);
}, [chunk_ids, mode, error]);
const groupedEntities = useMemo<{ [key: string]: GroupedEntity }>(() => {
return infoEntities.reduce((acc, entity) => {
const { label, text } = parseEntity(entity);
Expand Down Expand Up @@ -159,16 +161,20 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
</Typography>
</Box>
</Box>
<Tabs size='large' fill='underline' onChange={onChangeTabs} value={activeTab}>
{mode != 'graph' ? <Tabs.Tab tabId={3}>Sources used</Tabs.Tab> : <></>}
{mode === 'graph+vector' || mode === 'graph' ? <Tabs.Tab tabId={4}>Top Entities used</Tabs.Tab> : <></>}
{mode === 'graph' && cypher_query?.trim().length ? (
<Tabs.Tab tabId={6}>Generated Cypher Query</Tabs.Tab>
) : (
<></>
)}
{mode != 'graph' ? <Tabs.Tab tabId={5}>Chunks</Tabs.Tab> : <></>}
</Tabs>
{error?.length > 0 ? (
<Banner type='danger'>{error}</Banner>
) : (
<Tabs size='large' fill='underline' onChange={onChangeTabs} value={activeTab}>
{mode != 'graph' ? <Tabs.Tab tabId={3}>Sources used</Tabs.Tab> : <></>}
{mode === 'graph+vector' || mode === 'graph' ? <Tabs.Tab tabId={4}>Top Entities used</Tabs.Tab> : <></>}
{mode === 'graph' && cypher_query?.trim().length ? (
<Tabs.Tab tabId={6}>Generated Cypher Query</Tabs.Tab>
) : (
<></>
)}
{mode != 'graph' ? <Tabs.Tab tabId={5}>Chunks</Tabs.Tab> : <></>}
</Tabs>
)}
<Flex className='p-4'>
<Tabs.TabPanel className='n-flex n-flex-col n-gap-token-4 n-p-token-6' value={activeTab} tabId={3}>
{sources.length ? (
Expand Down Expand Up @@ -210,17 +216,6 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
</Typography>
</div>
)}
{link?.startsWith('s3://') && (
<div className='flex flex-row inline-block justify-between items-center'>
<img src={s3logo} width={20} height={20} className='mr-2' alt='S3 Logo' />
<Typography
variant='body-medium'
className='text-ellipsis whitespace-nowrap overflow-hidden max-w-lg'
>
{decodeURIComponent(link).split('/').at(-1) ?? 'S3 File'}
</Typography>
</div>
)}
{youtubeLinkValidation(link) && (
<>
<div className='flex flex-row inline-block justiy-between items-center'>
Expand Down Expand Up @@ -250,6 +245,16 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
</div>
)}
</>
) : link?.startsWith('s3://') ? (
<div className='flex flex-row inline-block justify-between items-center'>
<img src={s3logo} width={20} height={20} className='mr-2' alt='S3 Logo' />
<Typography
variant='body-medium'
className='text-ellipsis whitespace-nowrap overflow-hidden max-w-lg'
>
{decodeURIComponent(link).split('/').at(-1) ?? 'S3 File'}
</Typography>
</div>
) : (
<div className='flex flex-row inline-block justify-between items-center'>
<DocumentTextIconOutline className='n-size-token-7 mr-2' />
Expand Down Expand Up @@ -385,6 +390,7 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
<img src={s3logo} width={20} height={20} className='mr-2' />
<Typography variant='subheading-medium'>{chunk?.fileName}</Typography>
</div>
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
</>
) : chunk?.url &&
!chunk?.url.startsWith('s3://') &&
Expand All @@ -400,6 +406,10 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
</div>
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
</>
) : chunk.fileSource === 'local file' ? (
<>
<Typography variant='subheading-small'>Similarity Score: {chunk?.score}</Typography>
</>
) : (
<></>
)}
Expand Down
Loading