mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-09 17:31:19 +00:00
🏷️ feat: Hide Model Spec Badge Rows (#13124)
* feat: hide model spec badge row * chore: import order * feat: hide model spec badge row
This commit is contained in:
parent
62da4c28ed
commit
738ed005b6
4 changed files with 21 additions and 3 deletions
|
|
@ -21,12 +21,13 @@ import {
|
|||
useSubmitMessage,
|
||||
useFocusChatEffect,
|
||||
} from '~/hooks';
|
||||
import PendingManualSkillsChips from './PendingManualSkillsChips';
|
||||
import { cn, getModelSpec, removeFocusRings } from '~/utils';
|
||||
import { useGetStartupConfig } from '~/data-provider';
|
||||
import { mainTextareaId, BadgeItem } from '~/common';
|
||||
import AttachFileChat from './Files/AttachFileChat';
|
||||
import FileFormChat from './Files/FileFormChat';
|
||||
import { cn, removeFocusRings } from '~/utils';
|
||||
import TextareaHeader from './TextareaHeader';
|
||||
import PendingManualSkillsChips from './PendingManualSkillsChips';
|
||||
import SkillsCommand from './SkillsCommand';
|
||||
import PromptsCommand from './PromptsCommand';
|
||||
import AudioRecorder from './AudioRecorder';
|
||||
|
|
@ -96,11 +97,17 @@ const ChatForm = memo(function ChatForm({
|
|||
setConversation: setAddedConvo,
|
||||
} = useAddedChatContext();
|
||||
const assistantMap = useAssistantsMapContext();
|
||||
const { data: startupConfig } = useGetStartupConfig();
|
||||
|
||||
const endpoint = useMemo(
|
||||
() => conversation?.endpointType ?? conversation?.endpoint,
|
||||
[conversation?.endpointType, conversation?.endpoint],
|
||||
);
|
||||
const modelSpec = useMemo(
|
||||
() => getModelSpec({ specName: conversation?.spec, startupConfig }),
|
||||
[conversation?.spec, startupConfig],
|
||||
);
|
||||
const hideBadgeRow = modelSpec?.hideBadgeRow === true;
|
||||
const conversationId = useMemo(
|
||||
() => conversation?.conversationId ?? Constants.NEW_CONVO,
|
||||
[conversation?.conversationId],
|
||||
|
|
@ -355,7 +362,10 @@ const ChatForm = memo(function ChatForm({
|
|||
</div>
|
||||
<BadgeRow
|
||||
showEphemeralBadges={
|
||||
!!endpoint && !isAgentsEndpoint(endpoint) && !isAssistantsEndpoint(endpoint)
|
||||
!!endpoint &&
|
||||
!hideBadgeRow &&
|
||||
!isAgentsEndpoint(endpoint) &&
|
||||
!isAssistantsEndpoint(endpoint)
|
||||
}
|
||||
isSubmitting={isSubmitting}
|
||||
conversationId={conversationId}
|
||||
|
|
|
|||
|
|
@ -624,6 +624,7 @@ endpoints:
|
|||
# label: "General Assistant"
|
||||
# description: "General purpose assistant"
|
||||
# # No 'group' field - appears as standalone item at top level (not nested)
|
||||
# # hideBadgeRow: true # Optional: hides the tool badge row for this spec
|
||||
# preset:
|
||||
# endpoint: "openAI"
|
||||
# model: "gpt-4o-mini"
|
||||
|
|
|
|||
|
|
@ -767,11 +767,15 @@ describe('specsConfigSchema', () => {
|
|||
{
|
||||
name: 'spec-1',
|
||||
label: 'Spec 1',
|
||||
hideBadgeRow: true,
|
||||
preset: { endpoint: EModelEndpoint.openAI },
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.data.list[0].hideBadgeRow).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('still rejects null list', () => {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ export type TModelSpec = {
|
|||
showIconInHeader?: boolean;
|
||||
iconURL?: string | EModelEndpoint; // Allow using project-included icons
|
||||
authType?: AuthType;
|
||||
/** Hide the chat input tool badge row while this model spec is active. */
|
||||
hideBadgeRow?: boolean;
|
||||
webSearch?: boolean;
|
||||
fileSearch?: boolean;
|
||||
executeCode?: boolean;
|
||||
|
|
@ -52,6 +54,7 @@ export const tModelSpecSchema = z.object({
|
|||
showIconInHeader: z.boolean().optional(),
|
||||
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
|
||||
authType: authTypeSchema.optional(),
|
||||
hideBadgeRow: z.boolean().optional(),
|
||||
webSearch: z.boolean().optional(),
|
||||
fileSearch: z.boolean().optional(),
|
||||
executeCode: z.boolean().optional(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue