mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-24 03:41:56 +03:00
fix: update crawl and upload endpoints (#1142)
This commit is contained in:
parent
7e1e13fab5
commit
72659709a8
@ -1,6 +1,7 @@
|
||||
import os
|
||||
import shutil
|
||||
from tempfile import SpooledTemporaryFile
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from auth import AuthBearer, get_current_user
|
||||
@ -33,7 +34,7 @@ async def crawl_endpoint(
|
||||
request: Request,
|
||||
crawl_website: CrawlWebsite,
|
||||
brain_id: UUID = Query(..., description="The ID of the brain"),
|
||||
chat_id: UUID = Query(..., description="The ID of the chat"),
|
||||
chat_id: Optional[UUID] = Query(None, description="The ID of the chat"),
|
||||
enable_summarization: bool = False,
|
||||
current_user: UserIdentity = Depends(get_current_user),
|
||||
):
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from auth import AuthBearer, get_current_user
|
||||
@ -36,7 +37,7 @@ async def upload_file(
|
||||
request: Request,
|
||||
uploadFile: UploadFile,
|
||||
brain_id: UUID = Query(..., description="The ID of the brain"),
|
||||
chat_id: UUID = Query(..., description="The ID of the chat"),
|
||||
chat_id: Optional[UUID] = Query(None, description="The ID of the chat"),
|
||||
enable_summarization: bool = False,
|
||||
current_user: UserIdentity = Depends(get_current_user),
|
||||
):
|
||||
|
@ -22,8 +22,12 @@ export type CrawlResponse = {
|
||||
export const crawlWebsiteUrl = async (
|
||||
props: CrawlInputProps,
|
||||
axiosInstance: AxiosInstance
|
||||
): Promise<CrawlResponse> =>
|
||||
axiosInstance.post(
|
||||
`/crawl?brain_id=${props.brainId}&chat_id=${props.chat_id ?? ""}`,
|
||||
props.config
|
||||
);
|
||||
): Promise<CrawlResponse> => {
|
||||
let crawlUrl = `/crawl?brain_id=${props.brainId}`;
|
||||
|
||||
if (props.chat_id !== undefined) {
|
||||
crawlUrl = crawlUrl.concat(`&chat_id=${props.chat_id}`);
|
||||
}
|
||||
|
||||
return axiosInstance.post(crawlUrl, props.config);
|
||||
};
|
||||
|
@ -16,8 +16,11 @@ export type UploadInputProps = {
|
||||
export const uploadFile = async (
|
||||
props: UploadInputProps,
|
||||
axiosInstance: AxiosInstance
|
||||
): Promise<UploadResponse> =>
|
||||
axiosInstance.post(
|
||||
`/upload?brain_id=${props.brainId}&chat_id=${props.chat_id ?? ""}`,
|
||||
props.formData
|
||||
);
|
||||
): Promise<UploadResponse> => {
|
||||
let uploadUrl = `/upload?brain_id=${props.brainId}`;
|
||||
if (props.chat_id !== undefined) {
|
||||
uploadUrl = uploadUrl.concat(`&chat_id=${props.chat_id}`);
|
||||
}
|
||||
|
||||
return axiosInstance.post(uploadUrl, props.formData);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user