LibreChat/packages/data-provider/src/models.ts
Danny Avila 90b8769ef3
🚀 feat: Use Model Specs + Specific Endpoints, Limit Providers for Agents (#6650)
* 🔧 refactor: Remove modelSpecs prop from ModelSelector and related components

* fix: Update submission.conversationId references in SSE hooks and data types as was incorrectly typed

* feat: Allow showing specific endpoints alongside model specs via `addedEndpoints` field

* feat: allowed agents providers via `agents.allowedProviders` field

* fix: bump dicebear/sharp dependencies to resolve CVE-2024-12905 and improve avatar gen logic

* fix: rename variable for clarity in loadDefaultInterface function

* fix: add keepAddedConvos option to newConversation calls for modular chat support

* fix: include model information in endpoint selection for improved context

* fix: update data-provider version to 0.7.78 and increment config version to 1.2.4
2025-04-01 03:50:32 -04:00

44 lines
1.2 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),
addedEndpoints: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),
});
export type TSpecsConfig = z.infer<typeof specsConfigSchema>;