ok
This commit is contained in:
@@ -53,14 +53,13 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
|||||||
setMessages(newMessages);
|
setMessages(newMessages);
|
||||||
setInput('');
|
setInput('');
|
||||||
setTimeout(() => setIsLoading(true), 1000);
|
setTimeout(() => setIsLoading(true), 1000);
|
||||||
const messagesToSend = newMessages.slice(1);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Send to backend
|
// Send to backend
|
||||||
const response = await fetch('https://botdev.kediritechnopark.com/webhook/master-agent/ask', {
|
const response = await fetch('https://botdev.kediritechnopark.com/webhook/master-agent/ask', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ pertanyaan: messagesToSend, sessionId: JSON.parse(localStorage.getItem('session')).sessionId, lastSeen: new Date().toISOString() }),
|
body: JSON.stringify({ pertanyaan: message, sessionId: JSON.parse(localStorage.getItem('session')).sessionId, lastSeen: new Date().toISOString() }),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) throw new Error('Network response was not ok');
|
if (!response.ok) throw new Error('Network response was not ok');
|
||||||
|
|||||||
Reference in New Issue
Block a user