Skip to content

Communities Bug fixes #775

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 31 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
76547be
added global search+vector+fulltext mode
vasanthasaikalluri Sep 23, 2024
0db3df5
added community details in chunk entities
vasanthasaikalluri Sep 23, 2024
ffe7a68
added node ids
vasanthasaikalluri Sep 24, 2024
88b5cd9
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Sep 24, 2024
0330f49
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Sep 24, 2024
46168e4
updated vector graph query
vasanthasaikalluri Sep 24, 2024
7ae1d6c
added entities and modified chat response
vasanthasaikalluri Sep 25, 2024
c100e9d
added params
vasanthasaikalluri Sep 25, 2024
574d69d
Merge branch 'global_search_fulltext' of https://github.com/neo4j-lab…
prakriti-solankey Sep 25, 2024
2afc3ae
api response changes
prakriti-solankey Sep 25, 2024
492f564
added chunk entity query
vasanthasaikalluri Sep 25, 2024
87874bd
modifies query
vasanthasaikalluri Sep 25, 2024
cbb91b1
labels cahnge for nodes
prakriti-solankey Sep 25, 2024
d6fb439
payload changes
prakriti-solankey Sep 25, 2024
da71b89
added nodetails properties
vasanthasaikalluri Sep 25, 2024
86d2b8e
payload new changes
prakriti-solankey Sep 25, 2024
fdd9909
communities check
prakriti-solankey Sep 26, 2024
a1518a3
communities selecetion check
prakriti-solankey Sep 26, 2024
3668a18
enable communities
prakriti-solankey Sep 26, 2024
8004609
removed the selected prop
kartikpersistent Sep 26, 2024
703ee0c
enable communities label change
prakriti-solankey Sep 26, 2024
58a4c57
Merge branch 'global_search_fulltext' of https://github.com/neo4j-lab…
prakriti-solankey Sep 26, 2024
5f753c4
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Sep 26, 2024
9b7cbf5
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Sep 30, 2024
beb1ef0
communities name change
prakriti-solankey Sep 30, 2024
64d7445
cred check
prakriti-solankey Sep 30, 2024
c0c304b
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Oct 1, 2024
0482b0c
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Oct 3, 2024
ee54387
tooltip
prakriti-solankey Oct 3, 2024
0b6b04c
fix: Copy Icon Theme Fix
kartikpersistent Oct 8, 2024
0badba4
Merge branch 'DEV' into communities
prakriti-solankey Oct 10, 2024
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
1 change: 1 addition & 0 deletions backend/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ async def upload_large_file_into_chunks(file:UploadFile = File(...), chunkNumber
elapsed_time = end - start
json_obj = {'api_name':'upload','db_url':uri, 'logging_time': formatted_time(datetime.now(timezone.utc)), 'elapsed_api_time':f'{elapsed_time:.2f}'}
logger.log_struct(json_obj, "INFO")
# result['elapsed_api_time'] = f'{elapsed_time:.2f}'
if int(chunkNumber) == int(totalChunks):
return create_api_response('Success',data=result, message='Source Node Created Successfully')
else:
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/ChatBot/ChatModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function ChatModeToggle({
}) {
const { setchatModes, chatModes, postProcessingTasks, selectedRows } = useFileContext();
const isCommunityAllowed = postProcessingTasks.includes('enable_communities');
const { isGdsActive } = useCredentials();
const { isGdsActive, userCredentials } = useCredentials();

useEffect(() => {
// If rows are selected, the mode is valid (either vector or graph+vector)
Expand All @@ -43,6 +43,7 @@ export default function ChatModeToggle({
}
}
}, [selectedRows.length, chatModes.length]);

const memoizedChatModes = useMemo(() => {
return isGdsActive && isCommunityAllowed
? AvailableModes
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ChatBot/Communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ReactMarkdown from 'react-markdown';
import { CommunitiesProps } from '../../types';

const CommunitiesInfo: FC<CommunitiesProps> = ({ loading, communities }) => {
console.log('communities', communities);
return (
<>
{loading ? (
Expand Down
40 changes: 40 additions & 0 deletions frontend/src/components/ChatBot/CommunitiesInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Box, LoadingSpinner, Flex, Typography } from '@neo4j-ndl/react';
import { FC } from 'react';
import ReactMarkdown from 'react-markdown';
import { CommunitiesProps } from '../../types';

const CommunitiesInfo: FC<CommunitiesProps> = ({ loading, communities }) => {
return (
<>
{loading ? (
<Box className='flex justify-center items-center'>
<LoadingSpinner size='small' />
</Box>
) : communities?.length > 0 ? (
<div className='p-4 h-80 overflow-auto'>
<ul className='list-disc list-inside'>
{communities.map((community, index) => (
<li key={`${community.id}${index}`} className='mb-2'>
<div>
<Flex flexDirection='row' gap='2'>
<Typography variant='subheading-medium'>ID : </Typography>
<Typography variant='subheading-medium'>{community.id}</Typography>
</Flex>
<Flex flexDirection='row' gap='2'>
<Typography variant='subheading-medium'>Score : </Typography>
{community.score && <Typography variant='subheading-medium'>{community.score}</Typography>}
</Flex>
<ReactMarkdown>{community.summary}</ReactMarkdown>
</div>
</li>
))}
</ul>
</div>
) : (
<span className='h6 text-center'> No Communities Found</span>
)}
</>
);
};

export default CommunitiesInfo;
13 changes: 12 additions & 1 deletion frontend/src/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ import { postProcessing } from '../services/PostProcessing';
import { triggerStatusUpdateAPI } from '../services/ServerSideStatusUpdateAPI';
import useServerSideEvent from '../hooks/useSse';
import { useSearchParams } from 'react-router-dom';
import { batchSize, buttonCaptions, defaultLLM, largeFileSize, llms, RETRY_OPIONS, tooltips } from '../utils/Constants';
import {
batchSize,
buttonCaptions,
chatModeLables,
defaultLLM,
largeFileSize,
llms,
RETRY_OPIONS,
tooltips,
} from '../utils/Constants';
import ButtonWithToolTip from './UI/ButtonWithToolTip';
import connectAPI from '../services/ConnectAPI';
import DropdownComponent from './Dropdown';
Expand Down Expand Up @@ -96,6 +105,7 @@ const Content: React.FC<ContentProps> = ({
queue,
processedCount,
setProcessedCount,
setchatMode,
} = useFileContext();
const [viewPoint, setViewPoint] = useState<'tableView' | 'showGraphView' | 'chatInfoView'>('tableView');
const [showDeletePopUp, setshowDeletePopUp] = useState<boolean>(false);
Expand Down Expand Up @@ -542,6 +552,7 @@ const Content: React.FC<ContentProps> = ({
setSelectedNodes([]);
setSelectedRels([]);
setClearHistoryData(true);
setchatMode(chatModeLables.graph_vector_fulltext);
};

const retryHandler = async (filename: string, retryoption: string) => {
Expand Down
60 changes: 48 additions & 12 deletions frontend/src/components/FileTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import {
ProgressBar,
StatusIndicator,
TextLink,
Tip,
Typography,
useCopyToClipboard,
} from '@neo4j-ndl/react';
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import {
useReactTable,
getCoreRowModel,
Expand All @@ -35,7 +37,11 @@ import {
} from '../utils/Utils';
import { SourceNode, CustomFile, FileTableProps, UserCredentials, statusupdate, ChildRef } from '../types';
import { useCredentials } from '../context/UserCredentials';
import { ArrowPathIconSolid, MagnifyingGlassCircleIconSolid } from '@neo4j-ndl/react/icons';
import {
ArrowPathIconSolid,
ClipboardDocumentIconOutline,
MagnifyingGlassCircleIconSolid,
} from '@neo4j-ndl/react/icons';
import CustomProgressBar from './UI/CustomProgressBar';
import subscribe from '../services/PollingAPI';
import { triggerStatusUpdateAPI } from '../services/ServerSideStatusUpdateAPI';
Expand All @@ -47,7 +53,9 @@ import { IconButtonWithToolTip } from './UI/IconButtonToolTip';
import { batchSize, largeFileSize, llms } from '../utils/Constants';
import IndeterminateCheckbox from './UI/CustomCheckBox';
import { showErrorToast, showNormalToast } from '../utils/toasts';
import { ThemeWrapperContext } from '../context/ThemeWrapper';
let onlyfortheFirstRender = true;

const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
const { isExpanded, connectionStatus, setConnectionStatus, onInspect, onRetry } = props;
const { filesData, setFilesData, model, rowSelection, setRowSelection, setSelectedRows, setProcessedCount, queue } =
Expand All @@ -61,6 +69,8 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
const [fileSourceFilter, setFileSourceFilter] = useState<string>('');
const [llmtypeFilter, setLLmtypeFilter] = useState<string>('');
const skipPageResetRef = useRef<boolean>(false);
const [_, copy] = useCopyToClipboard();
const { colorMode } = useContext(ThemeWrapperContext);

const tableRef = useRef(null);

Expand All @@ -72,6 +82,10 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
showErrorToast(`${fileName} Failed to process`);
}
);

const handleCopy = (message: string) => {
copy(message);
};
const columns = useMemo(
() => [
{
Expand Down Expand Up @@ -140,14 +154,18 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
cell: (info) => {
if (info.getValue() != 'Processing') {
return (
<div
className='cellClass'
title={info.row.original?.status === 'Failed' ? info.row.original?.errorMessage : ''}
>
<StatusIndicator type={statusCheck(info.getValue())} />
{info.getValue()}
{(info.getValue() === 'Completed' || info.getValue() === 'Failed' || info.getValue() === 'Cancelled') &&
!isReadOnlyUser && (
<Tip allowedPlacements={['left']}>
<div
className='cellClass'
title={info.row.original?.status === 'Failed' ? info.row.original?.errorMessage : ''}
>
<Tip.Trigger>
<StatusIndicator type={statusCheck(info.getValue())} />
{info.getValue()}
</Tip.Trigger>
{(info.getValue() === 'Completed' ||
info.getValue() === 'Failed' ||
(info.getValue() === 'Cancelled' && !isReadOnlyUser)) && (
<span className='mx-1'>
<IconButtonWithToolTip
placement='right'
Expand All @@ -161,7 +179,25 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
</IconButtonWithToolTip>
</span>
)}
</div>
</div>

{info.row.original?.status === 'Failed' && (
<Tip.Content>
<IconButton
aria-label='error copy'
clean
label='copy error'
size='small'
onClick={() => handleCopy(info.row.original?.errorMessage ?? '')}
>
<ClipboardDocumentIconOutline
color={colorMode === 'light' ? 'white' : ''}
className='w-4 h-4 inline-block'
/>
</IconButton>
</Tip.Content>
)}
</Tip>
);
} else if (info.getValue() === 'Processing' && info.row.original.processingProgress === undefined) {
return (
Expand Down Expand Up @@ -510,7 +546,7 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
footer: (info) => info.column.id,
}),
],
[filesData.length, statusFilter, filetypeFilter, llmtypeFilter, fileSourceFilter, isReadOnlyUser]
[filesData.length, statusFilter, filetypeFilter, llmtypeFilter, fileSourceFilter, isReadOnlyUser, colorMode]
);

const table = useReactTable({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Layout/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const SideNav: React.FC<SideNavProps> = ({
<SideNavigation.Item
onClick={handleClick}
icon={
<TipWrapper tooltip={tooltips.chat} placement='right'>
<TipWrapper tooltip={tooltips.chat} placement='left'>
<ChatBubbleOvalLeftEllipsisIconOutline />
</TipWrapper>
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const chatModeLables = {
fulltext: 'fulltext',
graph_vector_fulltext: 'graph+vector+fulltext',
entity_vector: 'entity search+vector',
unavailableChatMode: 'Chat mode is unavailable when rows are selected',
unavailableChatMode: 'Chat mode is unavailable when files are selected',
selected: 'Selected',
global_vector: 'global search+vector+fulltext',
};
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const filterData = (
nodeIds.has(rel.to)
);
filteredScheme = Object.fromEntries(entityTypes.map((key) => [key, scheme[key]])) as Scheme;
console.log('labels', entityNodes);
// Only Communities
} else if (
graphType.includes('Communities') &&
Expand Down Expand Up @@ -332,6 +333,7 @@ export const filterData = (
filteredNodes = allNodes;
filteredRelations = allRelationships;
filteredScheme = scheme;
console.log('entity', filteredScheme);
}
return { filteredNodes, filteredRelations, filteredScheme };
};
Expand Down