ok
This commit is contained in:
BIN
public/dermalounge.jpg
Normal file
BIN
public/dermalounge.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 729 KiB |
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import styles from './ChatBot.module.css';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import styles from './ChatBot.module.css';
|
||||
|
||||
const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
const [messages, setMessages] = useState([
|
||||
{
|
||||
sender: 'bot',
|
||||
@@ -52,7 +52,6 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
|
||||
setMessages(newMessages);
|
||||
setInput('');
|
||||
setTimeout(() => setIsLoading(true), 1000);
|
||||
|
||||
try {
|
||||
// Send to backend
|
||||
@@ -66,7 +65,7 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
console.log(data)
|
||||
// Assuming your backend sends back something like: { answer: "text" }
|
||||
// Adjust this according to your actual response shape
|
||||
const botAnswer = data[0].output || data[0].output[0].text || 'Maaf, saya tidak mengerti.';
|
||||
const botAnswer = data[0].output[0].text || data[0].output || 'Maaf, saya tidak mengerti.';
|
||||
|
||||
// Add bot's reply
|
||||
setMessages(prev => [
|
||||
@@ -94,19 +93,14 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
return (
|
||||
<div className={styles.chatContainer} style={{ height: hh || '100vh' }}>
|
||||
<div className={styles.chatHeader}>
|
||||
<img src="https://i.ibb.co/YXxXr72/bot-avatar.png" alt="Bot Avatar" />
|
||||
<strong>Kloowear AI Assistant</strong>
|
||||
<img src="/dermalounge.jpg" alt="Bot Avatar" />
|
||||
<strong>DERMALOUNGE</strong>
|
||||
</div>
|
||||
|
||||
<div className={styles.chatBody}>
|
||||
|
||||
{isLoading && (
|
||||
<div className={`${styles.messageRow} ${styles.bot}`}>
|
||||
<img
|
||||
src="https://i.ibb.co/YXxXr72/bot-avatar.png"
|
||||
alt="Bot"
|
||||
className={styles.avatar}
|
||||
/>
|
||||
<div className={`${styles.message} ${styles.bot}`}>
|
||||
<em>Mengetik...</em>
|
||||
</div>
|
||||
@@ -117,13 +111,6 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
key={index}
|
||||
className={`${styles.messageRow} ${styles[msg.sender]}`}
|
||||
>
|
||||
{msg.sender === 'bot' && (
|
||||
<img
|
||||
src="https://i.ibb.co/YXxXr72/bot-avatar.png"
|
||||
alt="Bot"
|
||||
className={styles.avatar}
|
||||
/>
|
||||
)}
|
||||
<div className={`${styles.message} ${styles[msg.sender]}`}>
|
||||
{msg.text}
|
||||
{msg.quickReplies && (
|
||||
@@ -141,13 +128,6 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
)}
|
||||
<div className={styles.timestamp}>{msg.time}</div>
|
||||
</div>
|
||||
{msg.sender === 'user' && (
|
||||
<img
|
||||
src="https://i.ibb.co/4pDNDk1/user-avatar.png"
|
||||
alt="User"
|
||||
className={styles.avatar}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -167,11 +147,11 @@ const ChatBot = ({ existingConversation, readOnly, hh }) => {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
function getTime() {
|
||||
function getTime() {
|
||||
const now = new Date();
|
||||
return now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
}
|
||||
|
||||
export default ChatBot;
|
||||
export default ChatBot;
|
||||
|
||||
@@ -128,9 +128,9 @@ const Dashboard = () => {
|
||||
return (
|
||||
<div className={styles.dashboardContainer}>
|
||||
<div className={styles.dashboardHeader}>
|
||||
<img src="https://i.ibb.co/YXxXr72/bot-avatar.png" alt="Bot Avatar" />
|
||||
<img src="/dermalounge.jpg" alt="Bot Avatar" />
|
||||
<div>
|
||||
<h1>Kloowear AI Admin Dashboard</h1>
|
||||
<h1>Dermalounge AI Admin Dashboard</h1>
|
||||
<p>Statistik penggunaan chatbot secara real-time</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -159,6 +159,10 @@ const Dashboard = () => {
|
||||
<canvas ref={chartRef}></canvas>
|
||||
</div>
|
||||
|
||||
<div className={styles.footer}>
|
||||
UNTUK MENAMBAHKAN LAYANAN, KUNJUNGI <a href="https://drive.kediritechnopark.com">LINK INI</a>
|
||||
dengan username: dermalounge, password: 1234
|
||||
</div>
|
||||
<div className={styles.footer}>
|
||||
© 2025 Kloowear AI - Admin Panel
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user