refactor(sidebar): update AllChatsSidebar styling and folder type validation

- Enhanced padding and gap in AllChatsSidebar for improved layout consistency.
- Adjusted skeleton and button sizes for better usability in chat components.
- Refactored folder type validation to ensure search_space_id is set based on workspace_id when missing.
This commit is contained in:
Anish Sarkar 2026-07-06 13:05:29 +05:30
parent 192b9840f2
commit 7c9cb5abd3
2 changed files with 21 additions and 11 deletions

View file

@ -1,6 +1,6 @@
import { z } from "zod";
export const folder = z.object({
const folderBase = z.object({
id: z.number(),
name: z.string(),
position: z.string(),
@ -12,6 +12,16 @@ export const folder = z.object({
metadata: z.record(z.string(), z.any()).nullable().optional(),
});
export const folder = z.preprocess((value) => {
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
const record = value as Record<string, unknown>;
if (record.search_space_id === undefined && record.workspace_id !== undefined) {
return { ...record, search_space_id: record.workspace_id };
}
}
return value;
}, folderBase);
export const folderCreateRequest = z.object({
name: z.string().min(1).max(255),
parent_id: z.number().nullable().optional(),