2026-07-26 16:14:32 +07:00
|
|
|
import type { ChatbotResponse, ChatHistoryMessage } from "@/lib/types";
|
2026-07-26 11:27:21 +07:00
|
|
|
import { api } from "./client";
|
|
|
|
|
|
2026-07-26 16:14:32 +07:00
|
|
|
export const chatbotApi = {
|
2026-07-26 11:27:21 +07:00
|
|
|
send: (message: string) =>
|
2026-07-28 15:00:29 +07:00
|
|
|
api.post<ChatbotResponse>("/api/chat", { message }),
|
2026-07-26 11:27:21 +07:00
|
|
|
|
2026-07-28 15:00:29 +07:00
|
|
|
getHistory: () => api.get<ChatHistoryMessage[]>("/api/chat/history"),
|
2026-07-26 11:27:21 +07:00
|
|
|
|
2026-07-28 15:00:29 +07:00
|
|
|
clearHistory: () => api.delete<{ ok: boolean }>("/api/chat/history"),
|
2026-07-26 11:27:21 +07:00
|
|
|
};
|