mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-08-26 01:02:02 +00:00
- Added `document_id` to artifact listing for improved metadata association. - Introduced `ArtifactFormatIcon` and `ArtifactFormatLabel` components for better visual representation of artifact formats. - Updated various components to utilize new format handling, ensuring consistent display across the application. - Refactored artifact-related schemas and hooks to accommodate new format data. - Enhanced unit tests to cover new functionality and ensure robustness.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const ArtifactFileSchema = z.object({
|
|
file_id: z.number(),
|
|
role: z.enum(["primary", "preview"]),
|
|
filename: z.string(),
|
|
mime_type: z.string(),
|
|
size_bytes: z.number(),
|
|
content_url: z.string(),
|
|
});
|
|
|
|
const ArtifactLegacySchema = z
|
|
.object({
|
|
kind: z.string(),
|
|
id: z.number().int().positive(),
|
|
})
|
|
.optional();
|
|
|
|
export const ArtifactManifestSchema = z.object({
|
|
artifact_id: z.number(),
|
|
document_id: z.number(),
|
|
title: z.string(),
|
|
format: z.string(),
|
|
generation: z.number().int().positive(),
|
|
markdown_representation: z.string(),
|
|
files: z.array(ArtifactFileSchema),
|
|
updated_at: z.string().nullable(),
|
|
legacy: ArtifactLegacySchema,
|
|
});
|
|
|
|
export const ArtifactListItemSchema = z.object({
|
|
artifact_id: z.number(),
|
|
document_id: z.number(),
|
|
title: z.string(),
|
|
format: z.string(),
|
|
generation: z.number().int().positive(),
|
|
indexing_status: z.enum(["ready", "pending", "processing", "failed", "deleting"]),
|
|
thread_id: z.number().nullable(),
|
|
created_at: z.string(),
|
|
updated_at: z.string().nullable(),
|
|
legacy: ArtifactLegacySchema,
|
|
});
|
|
|
|
export const ArtifactListSchema = z.array(ArtifactListItemSchema);
|
|
|
|
export type ArtifactFile = z.infer<typeof ArtifactFileSchema>;
|
|
export type ArtifactManifest = z.infer<typeof ArtifactManifestSchema>;
|
|
export type ArtifactListItem = z.infer<typeof ArtifactListItemSchema>;
|