import type { chatbotPageContext } from "src/modules/chatbot/models/page-context.model"; import type { Message } from "src/modules/chatbot/models/dialogue-message.model"; import { api } from "src/boot/axios"; export const chatbotService = { // Function to send the message to the backend sendChatMessage: async (userInput: string): Promise => { const response = await api.post("/chatbot", { userInput }); return response.data as Message; }, // Function to send context to backend sendPageContext: async (context: chatbotPageContext): Promise => { const response = await api.post("/chatbot/context", context); return response.data; }, // Function to send user credentials to the backend to communicate with n8n. sendUserCredentials: async (email: string, role: string): Promise => { const response = await api.post("/chatbot/user", { email, role }); return response.data; }, retrieveCustomerDiagnostics: async (id: string): Promise => { const response = await api.get(`/chat/customer/${id}`); return response.data; }, };