mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-08 03:28:51 +01:00
* refactor: remove `useChatContext` from `useSelectMention`, explicitly pass `conversation` object * feat: ephemeral agents via model specs * refactor: Sync Jotai state with ephemeral agent state, also when Ephemeral Agent has no MCP servers selected * refactor: move `useUpdateEphemeralAgent` to store and clean up imports * refactor: reorder imports and invalidate queries for mcpConnectionStatus in event handler * refactor: replace useApplyModelSpecEffects with useApplyModelSpecAgents and update event handlers to use new agent template logic * ci: update useMCPSelect test to verify mcpValues sync with empty ephemeralAgent.mcp
60 lines
1.8 KiB
TypeScript
60 lines
1.8 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;
|
|
/**
|
|
* Optional group name for organizing specs in the UI selector.
|
|
* - If it matches an endpoint name (e.g., "openAI", "groq"), the spec appears nested under that endpoint
|
|
* - If it's a custom name (doesn't match any endpoint), it creates a separate collapsible group
|
|
* - If omitted, the spec appears as a standalone item at the top level
|
|
*/
|
|
group?: string;
|
|
showIconInMenu?: boolean;
|
|
showIconInHeader?: boolean;
|
|
iconURL?: string | EModelEndpoint; // Allow using project-included icons
|
|
authType?: AuthType;
|
|
webSearch?: boolean;
|
|
fileSearch?: boolean;
|
|
executeCode?: boolean;
|
|
mcpServers?: string[];
|
|
};
|
|
|
|
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(),
|
|
group: z.string().optional(),
|
|
showIconInMenu: z.boolean().optional(),
|
|
showIconInHeader: z.boolean().optional(),
|
|
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
|
|
authType: authTypeSchema.optional(),
|
|
webSearch: z.boolean().optional(),
|
|
fileSearch: z.boolean().optional(),
|
|
executeCode: z.boolean().optional(),
|
|
mcpServers: z.array(z.string()).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>;
|