mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-16 23:01:06 +02:00
add get document by chunks request / response zod schema
This commit is contained in:
parent
6f3b34f38c
commit
557e736a53
1 changed files with 21 additions and 0 deletions
|
|
@ -43,6 +43,16 @@ export const extensionDocumentContent = z.object({
|
||||||
pageContent: z.string(),
|
pageContent: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const documentWithChunks = document.extend({
|
||||||
|
chunks: z.array(
|
||||||
|
z.object({
|
||||||
|
id: z.number(),
|
||||||
|
content: z.string(),
|
||||||
|
created_at: z.string(),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get documents
|
* Get documents
|
||||||
*/
|
*/
|
||||||
|
|
@ -116,6 +126,15 @@ export const getDocumentTypeCountsRequest = z.object({
|
||||||
|
|
||||||
export const getDocumentTypeCountsResponse = z.record(z.string(), z.number());
|
export const getDocumentTypeCountsResponse = z.record(z.string(), z.number());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get document by chunk
|
||||||
|
*/
|
||||||
|
export const getDocumentByChunkRequest = z.object({
|
||||||
|
chunk_id: z.number(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDocumentByChunkResponse = documentWithChunks;
|
||||||
|
|
||||||
export type GetDocumentsRequest = z.infer<typeof getDocumentsRequest>;
|
export type GetDocumentsRequest = z.infer<typeof getDocumentsRequest>;
|
||||||
export type GetDocumentResponse = z.infer<typeof getDocumentResponse>;
|
export type GetDocumentResponse = z.infer<typeof getDocumentResponse>;
|
||||||
export type CreateDocumentRequest = z.infer<typeof createDocumentRequest>;
|
export type CreateDocumentRequest = z.infer<typeof createDocumentRequest>;
|
||||||
|
|
@ -126,3 +145,5 @@ export type SearchDocumentsRequest = z.infer<typeof searchDocumentsRequest>;
|
||||||
export type SearchDocumentsResponse = z.infer<typeof searchDocumentsResponse>;
|
export type SearchDocumentsResponse = z.infer<typeof searchDocumentsResponse>;
|
||||||
export type GetDocumentTypeCountsRequest = z.infer<typeof getDocumentTypeCountsRequest>;
|
export type GetDocumentTypeCountsRequest = z.infer<typeof getDocumentTypeCountsRequest>;
|
||||||
export type GetDocumentTypeCountsResponse = z.infer<typeof getDocumentTypeCountsResponse>;
|
export type GetDocumentTypeCountsResponse = z.infer<typeof getDocumentTypeCountsResponse>;
|
||||||
|
export type GetDocumentByChunkRequest = z.infer<typeof getDocumentByChunkRequest>;
|
||||||
|
export type GetDocumentByChunkResponse = z.infer<typeof getDocumentByChunkResponse>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue