This commit performs a major cleanup of the `adventure-rental-app` by removing all existing components, pages, layouts, and project brief documents. The application is reduced to a minimal Vite shell. - Deleted all authentication, chatbot, and dashboard components and pages. - Removed outdated project brief and PRD markdown files. - Updated Vite and `@vitejs/plugin-react` dependencies. Additionally, the `framer-motion` dependency was added to the `bookoomoo-app`.
38 lines
1015 B
JavaScript
Executable File
38 lines
1015 B
JavaScript
Executable File
// Contoh sederhana endpoint webhook
|
|
const express = require('express');
|
|
const app = express();
|
|
app.use(express.json());
|
|
|
|
const sessions = {};
|
|
|
|
app.post('/webhook', (req, res) => {
|
|
const { session_id, message } = req.body;
|
|
|
|
// Simpan pesan user
|
|
if (!sessions[session_id]) {
|
|
sessions[session_id] = [];
|
|
}
|
|
sessions[session_id].push({ sender: 'user', content: message });
|
|
|
|
// Proses pesan (contoh sederhana)
|
|
let response;
|
|
if (message.includes('harga')) {
|
|
response = "Produk paracord kami mulai dari Rp 25.000/meter. Mau lihat katalog?";
|
|
} else {
|
|
response = "Pesan diterima! Tim kami akan segera merespons.";
|
|
}
|
|
|
|
// Simpan pesan AI
|
|
sessions[session_id].push({ sender: 'ai', content: response });
|
|
|
|
res.json({ success: true });
|
|
});
|
|
|
|
app.get('/webhook/get', (req, res) => {
|
|
const { session_id } = req.query;
|
|
res.json({
|
|
new_messages: sessions[session_id]?.filter(msg => msg.sender === 'ai') || []
|
|
});
|
|
});
|
|
|
|
app.listen(3000, () => console.log('Webhook running on port 3000')); |