LibreChat/packages/data-provider/src/models.ts
Danny Avila 69a9b8b911
🐛 fix: Ensure Default ModelSpecs Are Set Correctly (#5218)
* 🐛 fix: default modelSpecs not being set

* feat: Add imageDetail parameter for OpenAI endpoints in tQueryParamsSchema

* feat: Implement processModelSpecs function to enhance model specs processing from configuration

* feat: Refactor configuration schemas and types for improved structure and clarity

* feat: Add append_current_datetime parameter to tQueryParamsSchema for enhanced endpoint functionality

* fix: Add endpointType to getSaveOptions and enhance endpoint handling in Settings component

* fix: Change endpointType to be nullable and optional in tConversationSchema for improved flexibility

* fix: allow save & submit for google endpoint
2025-01-08 21:57:00 -05:00

43 lines
1.1 KiB
TypeScript

import { z } from 'zod';
import type { TPreset } from './schemas';
import {
EModelEndpoint,
tPresetSchema,
eModelEndpointSchema,
AuthType,
authTypeSchema,
} from './schemas';
export type TModelSpec = {
name: string;
label: string;
preset: TPreset;
order?: number;
default?: boolean;
description?: string;
showIconInMenu?: boolean;
showIconInHeader?: boolean;
iconURL?: string | EModelEndpoint; // Allow using project-included icons
authType?: AuthType;
};
export const tModelSpecSchema = z.object({
name: z.string(),
label: z.string(),
preset: tPresetSchema,
order: z.number().optional(),
default: z.boolean().optional(),
description: z.string().optional(),
showIconInMenu: z.boolean().optional(),
showIconInHeader: z.boolean().optional(),
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
authType: authTypeSchema.optional(),
});
export const specsConfigSchema = z.object({
enforce: z.boolean().default(false),
prioritize: z.boolean().default(true),
list: z.array(tModelSpecSchema).min(1),
});
export type TSpecsConfig = z.infer<typeof specsConfigSchema>;