Skip to content

Bug Fixing #916

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 36 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
06b2c58
Staging to main (#735)
aashipandya Sep 9, 2024
b80a164
Update FileTable.tsx
kartikpersistent Oct 1, 2024
c7066ee
Merge branch 'STAGING' of https://github.com/neo4j-labs/llm-graph-bui…
prakriti-solankey Oct 25, 2024
1dcc84a
Merge branch 'main' of https://github.com/neo4j-labs/llm-graph-builder
prakriti-solankey Oct 25, 2024
c052227
merge changes
prakriti-solankey Oct 25, 2024
2669e60
Update README.md
kartikpersistent Oct 28, 2024
e9fec8e
Update README.md
kartikpersistent Oct 28, 2024
8d29146
Update README.md
kartikpersistent Oct 29, 2024
86efe46
Update README.md
kartikpersistent Oct 29, 2024
a357b74
Graph visualization improvement and chunk text details (#860)
aashipandya Nov 12, 2024
32f5064
enable communities removed and delete queries updated
kaustubh-darekar Nov 28, 2024
06963fb
nginx security headers
kartikpersistent Nov 28, 2024
ebd6207
removed parameter to include chunk nodes as entity source
aashipandya Nov 28, 2024
a7fa0b4
Ready to reprocess
kartikpersistent Nov 28, 2024
6aa7b66
Merge branch 'prod_v6_fix' of https://github.com/neo4j-labs/llm-graph…
kartikpersistent Nov 28, 2024
efd6218
communities fix
prakriti-solankey Nov 28, 2024
7903fed
dependency fix Reprocess fix
kartikpersistent Nov 28, 2024
4a79dc5
Merge branch 'prod_v6_fix' of https://github.com/neo4j-labs/llm-graph…
kartikpersistent Nov 28, 2024
763ab34
icon size fix
kartikpersistent Nov 28, 2024
7566ecc
z index fix
kartikpersistent Nov 28, 2024
74b1a2c
icon fix
kartikpersistent Nov 28, 2024
2da1f30
icon gap fix
kartikpersistent Nov 28, 2024
6ae6325
upload status
kartikpersistent Nov 28, 2024
c35b78d
Checkbox fix
kartikpersistent Nov 28, 2024
307d667
fix: table issue chat bot clear issue
kartikpersistent Nov 29, 2024
6a32abc
new document deletion, 2nd level community deletion handled
kaustubh-darekar Nov 29, 2024
5155f3f
claer history
prakriti-solankey Nov 29, 2024
4a53afc
Merge branch 'prod_v6_fix' of https://github.com/neo4j-labs/llm-graph…
prakriti-solankey Nov 29, 2024
f0a6b6c
graph info and delete query update
prakriti-solankey Nov 29, 2024
241d22b
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Dec 2, 2024
653c3ec
format changes
prakriti-solankey Dec 2, 2024
1d9c51d
refresh changes
prakriti-solankey Dec 3, 2024
698b863
refresh changes
prakriti-solankey Dec 3, 2024
b518c36
chat history changes
prakriti-solankey Dec 3, 2024
d61b5ce
Merge branch 'DEV' of https://github.com/neo4j-labs/llm-graph-builder…
prakriti-solankey Dec 3, 2024
d0b31c9
code refactor
prakriti-solankey Dec 3, 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
12 changes: 6 additions & 6 deletions frontend/src/components/ChatBot/Chatbot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
} else {
setListMessages((prev) =>
prev.map((msg) =>
(msg.id === chatbotMessageId ? { ...msg, modes: { ...msg.modes, [mode]: responseMode } } : msg)
msg.id === chatbotMessageId ? { ...msg, modes: { ...msg.modes, [mode]: responseMode } } : msg
)
);
}
Expand All @@ -264,7 +264,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
} else {
setListMessages((prev) =>
prev.map((msg) =>
(msg.id === chatbotMessageId ? { ...msg, modes: { ...msg.modes, [mode]: responseMode } } : msg)
msg.id === chatbotMessageId ? { ...msg, modes: { ...msg.modes, [mode]: responseMode } } : msg
)
);
}
Expand All @@ -273,15 +273,15 @@ const Chatbot: FC<ChatbotProps> = (props) => {
console.error(`API call failed for mode ${mode}:`, result.reason);
setListMessages((prev) =>
prev.map((msg) =>
(msg.id === chatbotMessageId
msg.id === chatbotMessageId
? {
...msg,
modes: {
...msg.modes,
[mode]: { message: 'Failed to fetch response for this mode.', error: result.reason },
},
}
: msg)
: msg
)
);
}
Expand All @@ -294,7 +294,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
if (error instanceof Error) {
setListMessages((prev) =>
prev.map((msg) =>
(msg.id === chatbotMessageId
msg.id === chatbotMessageId
? {
...msg,
isLoading: false,
Expand All @@ -306,7 +306,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
},
},
}
: msg)
: msg
)
);
}
Expand Down
32 changes: 17 additions & 15 deletions frontend/src/components/Graph/GraphViewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
const [graphType, setGraphType] = useState<GraphType[]>([]);
const [disableRefresh, setDisableRefresh] = useState<boolean>(false);
const [selected, setSelected] = useState<{ type: EntityType; id: string } | undefined>(undefined);
const [mode, setMode] = useState<boolean>(false);

const graphQuery: string =
graphType.includes('DocumentChunk') && graphType.includes('Entities')
? queryMap.DocChunkEntities
: graphType.includes('DocumentChunk')
? queryMap.DocChunks
: graphType.includes('Entities')
? queryMap.Entities
: '';
? queryMap.DocChunks
: graphType.includes('Entities')
? queryMap.Entities
: '';

// fit graph to original position
const handleZoomToFit = () => {
Expand Down Expand Up @@ -97,7 +98,12 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
}, []);

useEffect(() => {
const updateGraphType = graphTypeFromNodes(allNodes);
let updateGraphType;
if (mode) {
updateGraphType = graphTypeFromNodes(nodes);
} else {
updateGraphType = graphTypeFromNodes(allNodes);
}
if (Array.isArray(updateGraphType)) {
setGraphType(updateGraphType);
}
Expand All @@ -108,10 +114,10 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
const nodeRelationshipData =
viewPoint === graphLabels.showGraphView
? await graphQueryAPI(
userCredentials as UserCredentials,
graphQuery,
selectedRows?.map((f) => f.name)
)
userCredentials as UserCredentials,
graphQuery,
selectedRows?.map((f) => f.name)
)
: await graphQueryAPI(userCredentials as UserCredentials, graphQuery, [inspectedName ?? '']);
return nodeRelationshipData;
} catch (error: any) {
Expand Down Expand Up @@ -260,11 +266,10 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
const newGraphSelected = [...graphType];
if (currentIndex === -1) {
newGraphSelected.push(graph);
initGraph(newGraphSelected, allNodes, allRelationships, scheme);
} else {
newGraphSelected.splice(currentIndex, 1);
initGraph(newGraphSelected, allNodes, allRelationships, scheme);
}
initGraph(newGraphSelected, allNodes, allRelationships, scheme);
setSearchQuery('');
setGraphType(newGraphSelected);
setSelected(undefined);
Expand Down Expand Up @@ -295,11 +300,8 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
// Refresh the graph with nodes and relations if file is processing
const handleRefresh = () => {
setDisableRefresh(true);
setMode(true);
graphApi('refreshMode');
setGraphType(graphType);
setNodes(nodes);
setRelationships(relationships);
setScheme(newScheme);
};

// when modal closes reset all states to default
Expand Down
116 changes: 52 additions & 64 deletions frontend/src/components/Layout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ import useSpeechSynthesis from '../../hooks/useSpeech';
import FallBackDialog from '../UI/FallBackDialog';
import { envConnectionAPI } from '../../services/ConnectAPI';
import { healthStatus } from '../../services/HealthStatus';
import { useNavigate } from 'react-router';

const ConnectionModal = lazy(() => import('../Popups/ConnectionModal/ConnectionModal'));

interface PageLayoutProp {
isChatOnly?: boolean;
}

const PageLayout: React.FC<PageLayoutProp> = () => {
const PageLayout: React.FC = () => {
const [openConnection, setOpenConnection] = useState<connectionState>({
openPopUp: false,
chunksExists: false,
Expand All @@ -38,6 +36,8 @@ const PageLayout: React.FC<PageLayoutProp> = () => {
const [shows3Modal, toggleS3Modal] = useReducer((s) => !s, false);
const [showGCSModal, toggleGCSModal] = useReducer((s) => !s, false);
const [showGenericModal, toggleGenericModal] = useReducer((s) => !s, false);
const navigate = useNavigate();

const toggleLeftDrawer = () => {
if (largedesktops) {
setIsLeftExpanded(!isLeftExpanded);
Expand Down Expand Up @@ -87,6 +87,7 @@ const PageLayout: React.FC<PageLayoutProp> = () => {
const setUserCredentialsFromSession = (neo4jConnection: string) => {
if (!neo4jConnection) {
console.error('Invalid session data:', neo4jConnection);
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
return;
}
try {
Expand Down Expand Up @@ -138,87 +139,73 @@ const PageLayout: React.FC<PageLayoutProp> = () => {
return false;
}
};
// Handle case where session exists
let backendApiResponse;
try {
// Handle case where session exists
if (session && isDev) {
let backendApiResponse;
try {
backendApiResponse = await envConnectionAPI();
const connectionData = backendApiResponse.data;
const envCredentials = {
uri: connectionData.data.uri,
password: atob(connectionData.data.password),
userName: connectionData.data.user_name,
database: connectionData.data.database,
isReadonlyUser: !connectionData.data.write_access,
isGds: connectionData.data.gds_status,
};
if (isDev) {
backendApiResponse = await envConnectionAPI();
const connectionData = backendApiResponse.data;
const envCredentials = {
uri: connectionData.data.uri,
password: atob(connectionData.data.password),
userName: connectionData.data.user_name,
database: connectionData.data.database,
isReadonlyUser: !connectionData.data.write_access,
isGds: connectionData.data.gds_status,
};
if (session && isDev) {
const updated = updateSessionIfNeeded(envCredentials, session);
if (!updated) {
setUserCredentialsFromSession(session); // Using stored session if no update is needed
}
setConnectionStatus(Boolean(connectionData.data.graph_connection));
setIsBackendConnected(true);
handleDisconnectButtonState(false);
} catch (error) {
console.error('Error in DEV session handling:', error);
handleDisconnectButtonState(true);
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
setErrorMessage(backendApiResponse?.data.error);
}
} else {
// For PROD, picking the session values
setUserCredentialsFromSession(session as string);
setConnectionStatus(true);
setIsBackendConnected(true);
handleDisconnectButtonState(true);
return;
}
// Handle case where no session exists
if (isDev) {
let envAPiResponse;
try {
envAPiResponse = await envConnectionAPI();
const connectionData = envAPiResponse.data.data;
const credentials = {
uri: connectionData.uri,
password: atob(connectionData.password),
userName: connectionData.user_name,
database: connectionData.database,
isReadonlyUser: !connectionData.write_access,
isGds: connectionData.gds_status,
};
setUserCredentials(credentials);
else if (!session) {
setUserCredentials(envCredentials);
localStorage.setItem(
'neo4j.connection',
JSON.stringify({
uri: credentials.uri,
user: credentials.userName,
password: btoa(credentials.password),
database: credentials.database,
uri: envCredentials.uri,
user: envCredentials.userName,
password: btoa(envCredentials.password),
database: envCredentials.database,
userDbVectorIndex: 384,
isReadOnlyUser: credentials.isReadonlyUser,
isGDS: credentials.isGds,
isReadOnlyUser: envCredentials.isReadonlyUser,
isGDS: envCredentials.isGds,
})
);
setConnectionStatus(Boolean(connectionData.graph_connection));
setIsBackendConnected(true);
setConnectionStatus(true);
setGdsActive(envCredentials.isGds);
setIsReadOnlyUser(envCredentials.isReadonlyUser);
handleDisconnectButtonState(false);
} catch (error) {
console.error('Error in DEV no-session handling:', error);
}
}
else {
if (session && !isDev) {
// For PROD, picking the session values
setUserCredentialsFromSession(session as string);
setConnectionStatus(true);
handleDisconnectButtonState(true);
return;
}
else {
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
setErrorMessage(envAPiResponse?.data.error);
handleDisconnectButtonState(true);
}
} else {
// For PROD: Open modal to manually connect
handleDisconnectButtonState(true);
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
setIsBackendConnected(false);
}
} catch (error) {
console.error('Error in initializeConnection:', error);
setIsBackendConnected(false);
console.error('Error in DEV session handling:', error);
if (session) {
setUserCredentialsFromSession(session as string);
setConnectionStatus(true);
}
else {
setErrorMessage(backendApiResponse?.data.error);
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
}
handleDisconnectButtonState(true);
}
}
initializeConnection();
Expand Down Expand Up @@ -249,6 +236,7 @@ const PageLayout: React.FC<PageLayoutProp> = () => {
currentMode: 'graph+vector+fulltext',
},
]);
navigate('.', { replace: true, state: null });
}
} catch (error) {
console.log(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ export default function DeduplicationTab() {
const onRemove = (nodeid: string, similarNodeId: string) => {
setDuplicateNodes((prev) => {
return prev.map((d) =>
(d.e.elementId === nodeid
d.e.elementId === nodeid
? {
...d,
similar: d.similar.filter((n) => n.elementId != similarNodeId),
}
: d)
: d
);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default function SelectedJobList({
}) {
const ongoingPostProcessingTasks = useMemo(
() =>
(isGdsActive
isGdsActive
? postProcessingTasks.includes('enable_communities')
? postProcessingTasks
: postProcessingTasks.filter((s) => s != 'enable_communities')
: postProcessingTasks.filter((s) => s != 'enable_communities')),
: postProcessingTasks.filter((s) => s != 'enable_communities'),
[isGdsActive, postProcessingTasks]
);
return (
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 @@ -307,7 +307,7 @@ export const graphLabels = {
community: 'Communities',
noNodesRels: 'No Nodes and No relationships',
neighborView: 'neighborView',
chunksInfo: 'We are processing 50 chunks at a time',
chunksInfo: 'We are visualizing 50 chunks at a time',
};

export const RESULT_STEP_SIZE = 25;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export const isFileCompleted = (waitingFile: CustomFile, item: SourceNode) =>
waitingFile && item.status === 'Completed';

export const calculateProcessedCount = (prev: number, batchSize: number) =>
(prev === batchSize ? batchSize - 1 : prev + 1);
prev === batchSize ? batchSize - 1 : prev + 1;

export const isProcessingFileValid = (item: SourceNode, userCredentials: UserCredentials) => {
return item.status === 'Processing' && item.fileName != undefined && userCredentials && userCredentials.database;
Expand Down
Loading