quivr/frontend/lib/api/crawl/crawl.ts
Mamadou DICKO 9464707d40
feat: merge chat history with chat notifications (#1127)
* feat: add chat_id to upload and crawl payload

* feat(chat): return chat_history_with_notifications

* feat: explicit notification status on create

* feat: handle notifications in frontend

* feat: delete chat notifications on chat delete request
2023-09-07 17:23:31 +02:00

30 lines
668 B
TypeScript

import { AxiosInstance } from "axios";
import { UUID } from "crypto";
import { ToastData } from "@/lib/components/ui/Toast/domain/types";
export type CrawlInputProps = {
brainId: UUID;
chat_id?: UUID;
config: {
url: string;
js: boolean;
depth: number;
max_pages: number;
max_time: number;
};
};
export type CrawlResponse = {
data: { type: ToastData["variant"]; message: ToastData["text"] };
};
export const crawlWebsiteUrl = async (
props: CrawlInputProps,
axiosInstance: AxiosInstance
): Promise<CrawlResponse> =>
axiosInstance.post(
`/crawl?brain_id=${props.brainId}&chat_id=${props.chat_id ?? ""}`,
props.config
);