2026-07-31 16:54:41 +07:00
|
|
|
import type { ChatbotHistoryRow, ChatbotResponse } 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-31 16:54:41 +07:00
|
|
|
getHistory: () =>
|
|
|
|
|
api.get<{ history: ChatbotHistoryRow[]; total: number }>(
|
|
|
|
|
"/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
|
|
|
};
|