22 lines
759 B
TypeScript
22 lines
759 B
TypeScript
import type { contextObject } from "src/page-contexts/pages/types/context-object";
|
|
import type { Message } from "../types/dialogue-message";
|
|
import { api } from "src/boot/axios";
|
|
|
|
export const chatbotService = {
|
|
// Function to get the message from the backend
|
|
getChatMessage: async (userInput: string): Promise<Message> => {
|
|
const response = await api.post("/chat/respond", { userInput });
|
|
return response.data as Message;
|
|
},
|
|
|
|
sendUrl: async (url: string): Promise<string> => {
|
|
const response = await api.post("/chat/page-url", { url });
|
|
return response.data;
|
|
},
|
|
|
|
sendPageContext: async (context: contextObject): Promise<string> => {
|
|
const response = await api.post("/chat/context", context);
|
|
return response.data;
|
|
},
|
|
};
|