feat: support firecrawl frontend code (#5226)
This commit is contained in:
parent
8d1386df0f
commit
28554350de
51 changed files with 1979 additions and 145 deletions
|
|
@ -152,6 +152,10 @@ export const syncDocument: Fetcher<CommonResponse, CommonDocReq> = ({ datasetId,
|
|||
return get<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/notion/sync`)
|
||||
}
|
||||
|
||||
export const syncWebsite: Fetcher<CommonResponse, CommonDocReq> = ({ datasetId, documentId }) => {
|
||||
return get<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/website-sync`)
|
||||
}
|
||||
|
||||
export const preImportNotionPages: Fetcher<{ notion_info: DataSourceNotionWorkspace[] }, { url: string; datasetId?: string }> = ({ url, datasetId }) => {
|
||||
return get<{ notion_info: DataSourceNotionWorkspace[] }>(url, { params: { dataset_id: datasetId } })
|
||||
}
|
||||
|
|
@ -227,6 +231,37 @@ export const fetchDatasetApiBaseUrl: Fetcher<{ api_base_url: string }, string> =
|
|||
return get<{ api_base_url: string }>(url)
|
||||
}
|
||||
|
||||
export const fetchFirecrawlApiKey = () => {
|
||||
return get<CommonResponse>('api-key-auth/data-source')
|
||||
}
|
||||
|
||||
export const createFirecrawlApiKey: Fetcher<CommonResponse, Record<string, any>> = (body) => {
|
||||
return post<CommonResponse>('api-key-auth/data-source/binding', { body })
|
||||
}
|
||||
|
||||
export const removeFirecrawlApiKey: Fetcher<CommonResponse, string> = (id: string) => {
|
||||
return del<CommonResponse>(`api-key-auth/data-source/${id}`)
|
||||
}
|
||||
|
||||
export const createFirecrawlTask: Fetcher<CommonResponse, Record<string, any>> = (body) => {
|
||||
return post<CommonResponse>('website/crawl', {
|
||||
body: {
|
||||
...body,
|
||||
provider: 'firecrawl',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const checkFirecrawlTaskStatus: Fetcher<CommonResponse, string> = (jobId: string) => {
|
||||
return get<CommonResponse>(`website/crawl/status/${jobId}`, {
|
||||
params: {
|
||||
provider: 'firecrawl',
|
||||
},
|
||||
}, {
|
||||
silent: true,
|
||||
})
|
||||
}
|
||||
|
||||
type FileTypesRes = {
|
||||
allowed_extensions: string[]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue