Skip to content

Commit d89b031

Browse files
fixed input text ,initial greeting, time display on bot message
1 parent 2aad71c commit d89b031

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{
2-
"listMessages": [
1+
{
2+
"listMessages": [
33
{
44
"id": 1,
55
"message": "Hi, I need help with creating a Cypher query for Neo4j.",
@@ -8,7 +8,7 @@
88
},
99
{
1010
"id": 2,
11-
"message": "Hi there! Welcome to Neo4j Chat! Your insights are just a click away from completed files",
11+
"message": " Welcome to the Neo4j Knowledge Graph Chat. You can ask questions related to documents which have been completely processed.",
1212
"user": "chatbot",
1313
"datetime": "01/01/2024 00:00:00"
1414
},
@@ -20,8 +20,7 @@
2020
},
2121
{
2222
"id": 4,
23-
"message":
24-
"Alright, you can use the following query: `MATCH (e:Employee)-[:WORKS_IN]->(d:Department {name: 'IT'}) RETURN e.name`. This query matches nodes labeled 'Employee' related to the 'IT' department and returns their names.",
23+
"message": "Alright, you can use the following query: `MATCH (e:Employee)-[:WORKS_IN]->(d:Department {name: 'IT'}) RETURN e.name`. This query matches nodes labeled 'Employee' related to the 'IT' department and returns their names.",
2524
"user": "chatbot",
2625
"datetime": "01/01/2024 00:00:00"
2726
},
@@ -33,10 +32,9 @@
3332
},
3433
{
3534
"id": 6,
36-
"message":
37-
"To get the count, use: `MATCH (e:Employee)-[:WORKS_IN]->(d:Department {name: 'IT'}) RETURN count(e)`. This counts all the distinct 'Employee' nodes related to the 'IT' department.",
35+
"message": "To get the count, use: `MATCH (e:Employee)-[:WORKS_IN]->(d:Department {name: 'IT'}) RETURN count(e)`. This counts all the distinct 'Employee' nodes related to the 'IT' department.",
3836
"user": "chatbot",
3937
"datetime": "01/01/2024 00:00:00"
4038
}
41-
]
42-
}
39+
]
40+
}

frontend/src/components/Chatbot.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export default function Chatbot(props: ChatbotProps) {
5555
setListMessages((listMessages) => [...listMessages, userMessage]);
5656
try {
5757
setLoading(true)
58+
setInputMessage('');
5859
const chatresponse = await chatBotAPI(userCredentials, model, inputMessage);
5960
chatbotReply = chatresponse?.data?.message;
60-
setInputMessage('');
6161
simulateTypingEffect(chatbotReply);
6262
setLoading(false)
6363
} catch (error) {
@@ -147,7 +147,7 @@ export default function Chatbot(props: ChatbotProps) {
147147
fluid
148148
onChange={handleInputChange}
149149
/>
150-
<Button type='submit' disabled={loading}>Submit</Button>
150+
<Button type='submit' loading={loading}>Submit</Button>
151151
</form>
152152
</div>
153153
</div>

frontend/src/components/RightSideBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ interface RightSideBarProps {
99
}
1010

1111
const RightSideBar: React.FC<RightSideBarProps> = ({ showChatBot, closeChatBot }) => {
12-
const [messages, setMessages] = useState<messages[]>([chatbotmessages.listMessages[1]]);
12+
const date = new Date();
13+
const [messages, setMessages] = useState<messages[]>([{ ...chatbotmessages.listMessages[1], datetime: `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` }]);
1314
return (
1415
<Drawer
1516
expanded={showChatBot}

0 commit comments

Comments
 (0)