Skip to content

Commit df236a7

Browse files
Merge pull request #191 from neo4j-labs/DEV
DEV to STAGING
2 parents fd5ead1 + 9988cbc commit df236a7

35 files changed

+343
-269
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ KNN_MIN_SCORE = ""\
114114
https://github.com/neo4j-labs/llm-graph-builder/assets/121786590/b725a503-6ade-46d2-9e70-61d57443c311
115115
116116
## Links
117-
The Public [ Google cloud Run URL](https://staging-frontend-dcavk67s4a-uc.a.run.app/).
117+
The Public [ Google cloud Run URL](https://devfrontend-dcavk67s4a-uc.a.run.app).
118118
[Workspace URL](https://workspace-preview.neo4j.io/workspace)
119119
120120

backend/src/graphDB_dataAccess.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def create_source_node(self, obj_source_node:sourceNode):
4444
def update_source_node(self, obj_source_node:sourceNode):
4545
try:
4646
processed_time = obj_source_node.updated_at - obj_source_node.created_at
47-
job_status = "Completed"
4847
logging.info("Update source node properties")
4948
self.graph.query("""MERGE(d:Document {fileName :$fn}) SET d.status = $st, d.createdAt = $c_at,
5049
d.updatedAt = $u_at, d.processingTime = $pt, d.nodeCount= $n_count,

backend/src/main.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def create_source_node_graph_local_file(uri, userName, password, file, model, db
6262
logging.error(f"Error in creating document node: {error_message}")
6363
return create_api_response(job_status, message=message,error=error_message,file_source=obj_source_node.source,file_name=obj_source_node.file_name)
6464

65-
def create_source_node_graph_url(uri, userName, password ,model, source_url=None, db_name=None,wiki_query:List[str]=None,aws_access_key_id=None,aws_secret_access_key=None, gcs_bucket_name=None, gcs_bucket_folder=None):
65+
def create_source_node_graph_url(uri, userName, password ,model, source_url=None, db_name=None, wiki_query:str=None, aws_access_key_id=None,aws_secret_access_key=None, gcs_bucket_name=None, gcs_bucket_folder=None):
6666
"""
6767
Creates a source node in Neo4jGraph and sets properties.
6868
@@ -157,16 +157,19 @@ def create_source_node_graph_url(uri, userName, password ,model, source_url=None
157157
source_type = 'text'
158158
job_status = 'Completed'
159159
pages = WikipediaLoader(query=query.strip(), load_max_docs=1, load_all_available_meta=True).load()
160-
obj_source_node = sourceNode()
161-
obj_source_node.file_name = query.strip()
162-
obj_source_node.file_type = source_type
163-
obj_source_node.file_source = 'Wikipedia'
164-
obj_source_node.file_size = sys.getsizeof(pages[0].page_content)
165-
obj_source_node.model = model
166-
obj_source_node.url = pages[0].metadata['source']
167-
obj_source_node.created_at = datetime.now()
168-
obj_source_node.status = 'New'
169160
try:
161+
if not pages:
162+
Failed_count+=1
163+
continue
164+
obj_source_node = sourceNode()
165+
obj_source_node.file_name = query.strip()
166+
obj_source_node.file_type = source_type
167+
obj_source_node.file_source = 'Wikipedia'
168+
obj_source_node.file_size = sys.getsizeof(pages[0].page_content)
169+
obj_source_node.model = model
170+
obj_source_node.url = pages[0].metadata['source']
171+
obj_source_node.created_at = datetime.now()
172+
obj_source_node.status = 'New'
170173
graphDb_data_Access = graphDBdataAccess(graph)
171174
graphDb_data_Access.create_source_node(obj_source_node)
172175
success_count+=1
@@ -273,9 +276,17 @@ def extract_graph_from_file(uri, userName, password, model, db_name=None, file=N
273276
logging.error(f"Pdf content or Youtube transcript is not available")
274277
graphDb_data_Access.update_exception_db(file_name,message)
275278
return create_api_response(job_status,message=message,file_name=file_name)
276-
277-
# update_node_prop = "SET d.createdAt ='{}', d.updatedAt = '{}', d.processingTime = '{}',d.status = '{}', d.errorMessage = '{}',d.nodeCount= {}, d.relationshipCount = {}, d.model = '{}'"
278-
# pages = loader.load_and_split()
279+
280+
obj_source_node = sourceNode()
281+
status = "Processing"
282+
obj_source_node.file_name = file_name
283+
obj_source_node.status = status
284+
obj_source_node.created_at = start_time
285+
obj_source_node.updated_at = start_time
286+
logging.info(file_name)
287+
logging.info(obj_source_node)
288+
# graphDb_data_Access.update_source_node(obj_source_node)
289+
279290
full_document_content = ""
280291
bad_chars = ['"', "\n", "'"]
281292
for i in range(0,len(pages)):
@@ -336,7 +347,6 @@ def extract_graph_from_file(uri, userName, password, model, db_name=None, file=N
336347
obj_source_node.node_count = nodes_created
337348
obj_source_node.relationship_count = relationships_created
338349

339-
graphDb_data_Access = graphDBdataAccess(graph)
340350
graphDb_data_Access.update_source_node(obj_source_node)
341351

342352
output = {

backend/temp.pdf

-1.85 MB
Binary file not shown.

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ services:
4040
- /app/node_modules
4141
environment:
4242
- BACKEND_API_URL=${BACKEND_API_URL-}
43+
- BLOOM_URL=${BLOOM_URL}
44+
- REACT_APP_SOURCES=${REACT_APP_SOURCES}
4345
container_name: frontend
4446
ports:
4547
- "5173:5173"

frontend/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Step 1: Build the React application
22
FROM node:20 AS build
3-
ENV BACKEND_API_URL "https://staging-frontend-dcavk67s4a-uc.a.run.app/"
4-
ENV BLOOM_URL "https://bloom-latest.s3.eu-west-2.amazonaws.com/assets/index.html?connectURL=neo4j%2B://"
3+
ENV BACKEND_API_URL "https://devbackend-new-dcavk67s4a-uc.a.run.app"
4+
#ENV BLOOM_URL "https://bloom-latest.s3.eu-west-2.amazonaws.com/assets/index.html?connectURL={CONNECT_URL}&search=Show+me+a+graph"
5+
ENV BLOOM_URL "https://bloom-latest.s3.eu-west-2.amazonaws.com/assets/index.html?connectURL={CONNECT_URL}&search=Show+me+a+graph&featureGenAISuggestions=true&featureGenAISuggestionsInternal=true"
6+
ENV REACT_APP_SOURCES "local,wikipedia,s3,gcs"
57
WORKDIR /app
68
COPY package.json .npmrc yarn.lock ./
79
RUN yarn add @neo4j-nvl/interaction-handlers @neo4j-nvl/core @neo4j-nvl/react

frontend/src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848

4949
.contentWithChatBot {
50-
width: calc(-385px + 100dvw);
50+
width: calc(-425px + 100dvw);
5151
height: calc(100dvh - 60px);
5252
padding: 3px;
5353
display: flex;

frontend/src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import './App.css';
22
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
33
import ThemeWrapper from './context/ThemeWrapper';
44
import QuickStarter from './components/QuickStarter';
5-
function App() {
5+
const App: React.FC = () => {
66
return (
7-
// @ts-ignore
87
<ThemeWrapper>
98
<QuickStarter />
109
</ThemeWrapper>
1110
);
12-
}
11+
};
1312

1413
export default App;

frontend/src/components/ButtonWithToolTip.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
1-
import { Button, IconButton, Tip } from '@neo4j-ndl/react';
1+
import { IconButton, Tip } from '@neo4j-ndl/react';
22

33
const ButtonWithToolTip = ({
44
text,
55
children,
66
onClick,
7-
ishrefButton,
8-
href,
9-
target,
7+
size = 'medium',
8+
clean,
9+
grouped,
1010
}: {
1111
text: string;
1212
children: React.ReactNode;
1313
onClick?: () => void;
14-
ishrefButton?: boolean;
15-
href?: string;
16-
target?: string;
14+
size?: 'small' | 'medium' | 'large';
15+
clean?: boolean;
16+
grouped?: boolean;
1717
}) => {
1818
return (
1919
<Tip allowedPlacements={['left']}>
2020
<Tip.Trigger>
21-
{ishrefButton ? (
22-
<Button fill='outlined' href={href} target={target}>
23-
{children}
24-
</Button>
25-
) : (
26-
<IconButton aria-label={text} size='medium' clean grouped onClick={onClick}>
27-
{children}
28-
</IconButton>
29-
)}
21+
<IconButton aria-label={text} size={size} clean={clean} grouped={grouped} onClick={onClick}>
22+
{children}
23+
</IconButton>
3024
</Tip.Trigger>
3125
<Tip.Content isPortaled={false} style={{ whiteSpace: 'nowrap' }}>
3226
{text}

frontend/src/components/Chatbot.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react';
33
import { Button, Widget, Typography, Avatar, TextInput } from '@neo4j-ndl/react';
44
import ChatBotUserAvatar from '../assets/images/chatbot-user.png';
55
import ChatBotAvatar from '../assets/images/chatbot-ai.png';
6-
import { ChatbotProps } from '../types';
6+
import { ChatbotProps, UserCredentials } from '../types';
77
import { useCredentials } from '../context/UserCredentials';
88
import chatBotAPI from '../services/QnaAPI';
99
import { v4 as uuidv4 } from 'uuid';
@@ -80,7 +80,7 @@ export default function Chatbot(props: ChatbotProps) {
8080
setLoading(true);
8181
setInputMessage('');
8282
simulateTypingEffect(' ');
83-
const chatresponse = await chatBotAPI(userCredentials, inputMessage, sessionId);
83+
const chatresponse = await chatBotAPI(userCredentials as UserCredentials, inputMessage, sessionId);
8484
chatbotReply = chatresponse?.data?.message;
8585
simulateTypingEffect(chatbotReply);
8686
setLoading(false);
@@ -171,6 +171,7 @@ export default function Chatbot(props: ChatbotProps) {
171171
<form onSubmit={handleSubmit} className='flex gap-2.5 w-full'>
172172
<TextInput
173173
className='n-bg-palette-neutral-bg-default flex-grow-7 w-full'
174+
aria-label='chatbot-input'
174175
type='text'
175176
value={inputMessage}
176177
fluid

0 commit comments

Comments
 (0)