diff --git a/src/App.css b/src/App.css index 66ad3fb..5ff7858 100644 --- a/src/App.css +++ b/src/App.css @@ -1,5 +1,4 @@ .App { - height: 100vh; display: flex; align-items: end; justify-content: center; diff --git a/src/ChatBot.js b/src/ChatBot.js index 663349c..77680dd 100644 --- a/src/ChatBot.js +++ b/src/ChatBot.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import styles from './ChatBot.module.css'; -const ChatBot = () => { +const ChatBot = ({existingConversation, readOnly, hh}) => { const [messages, setMessages] = useState([ { sender: 'bot', @@ -14,9 +14,15 @@ const ChatBot = () => { ], }, ]); + const [input, setInput] = useState(''); const [isLoading, setIsLoading] = useState(false); +useEffect(()=>{ + if (existingConversation && existingConversation.length > 0) { + setMessages(existingConversation); + } +}, [existingConversation]) useEffect(() => { if (!localStorage.getItem('session')) { function generateUUID() { @@ -46,7 +52,7 @@ const ChatBot = () => { setMessages(newMessages); setInput(''); - setIsLoading(true); +setTimeout(() => setIsLoading(true), 1000); try { // Send to backend @@ -85,7 +91,7 @@ const ChatBot = () => { }; return ( -
Total Percakapan Hari Ini
Pesan dari Pengguna
Respons Bot
Pengguna Aktif Sekarang
Total Percakapan Hari Ini
+Pesan dari Pengguna
+Respons Bot
+Paling sering ditanyakan
+