mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 08:02:03 +03:00
9464707d40
* 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
30 lines
668 B
TypeScript
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
|
|
);
|