This commit is contained in:
everythingonblack
2025-06-10 12:30:33 +07:00
parent 8749e6b54d
commit 7aa7a9dc7c

View File

@@ -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');