mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-29 06:38:50 +01:00
✨ feat: Add badge support to model specifications with TBadge type and schema
This commit is contained in:
parent
acafdb54c2
commit
b50406ab9e
2 changed files with 26 additions and 5 deletions
|
|
@ -76,6 +76,19 @@ const MenuItem: FC<MenuItemProps> = ({
|
|||
<div>
|
||||
{title}
|
||||
<div className="text-token-text-tertiary">{description}</div>
|
||||
{spec.badges && spec.badges.length > 0 && (
|
||||
<div className="mt-1 flex gap-2">
|
||||
{spec.badges.map((badge, index) => (
|
||||
<span
|
||||
key={index}
|
||||
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold shadow-sm"
|
||||
style={{ backgroundColor: badge.color, color: '#fff' }}
|
||||
>
|
||||
{badge.text}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ import {
|
|||
authTypeSchema,
|
||||
} from './schemas';
|
||||
|
||||
export type TBadge = {
|
||||
text: string;
|
||||
color: string;
|
||||
};
|
||||
|
||||
export type TModelSpec = {
|
||||
name: string;
|
||||
label: string;
|
||||
|
|
@ -19,11 +24,15 @@ export type TModelSpec = {
|
|||
showIconInHeader?: boolean;
|
||||
iconURL?: string | EModelEndpoint; // Allow using project-included icons
|
||||
authType?: AuthType;
|
||||
groups?: Array<string>; // List of group ObjectIds allowed to access this model
|
||||
// badgeIcon?: string; // URL to badge icon for visual categorization
|
||||
// badgeTooltip?: string; // Tooltip text for the badge
|
||||
groups?: string[];
|
||||
badges?: TBadge[];
|
||||
};
|
||||
|
||||
export const tBadgeSchema = z.object({
|
||||
text: z.string(),
|
||||
color: z.string(),
|
||||
});
|
||||
|
||||
export const tModelSpecSchema = z.object({
|
||||
name: z.string(),
|
||||
label: z.string(),
|
||||
|
|
@ -36,8 +45,7 @@ export const tModelSpecSchema = z.object({
|
|||
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
|
||||
authType: authTypeSchema.optional(),
|
||||
groups: z.array(z.string()).optional(),
|
||||
// badgeIcon: z.string().url('Must be a valid URL').optional(),
|
||||
// badgeTooltip: z.string().optional(),
|
||||
badges: z.array(tBadgeSchema).optional(),
|
||||
});
|
||||
|
||||
export const specsConfigSchema = z.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue