mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 14:18:51 +01:00
📛 feat: Chat Badges via Model Specs (#10272)
* 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
This commit is contained in:
parent
64df54528d
commit
33d6b337bc
17 changed files with 254 additions and 41 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
Constants,
|
||||
EModelEndpoint,
|
||||
defaultEndpoints,
|
||||
modularEndpoints,
|
||||
|
|
@ -176,6 +177,39 @@ export function getConvoSwitchLogic(params: ConversationInitParams): InitiatedTe
|
|||
};
|
||||
}
|
||||
|
||||
export function getModelSpec({
|
||||
specName,
|
||||
startupConfig,
|
||||
}: {
|
||||
specName?: string | null;
|
||||
startupConfig?: t.TStartupConfig;
|
||||
}): t.TModelSpec | undefined {
|
||||
if (!startupConfig || !specName) {
|
||||
return;
|
||||
}
|
||||
return startupConfig.modelSpecs?.list?.find((spec) => spec.name === specName);
|
||||
}
|
||||
|
||||
export function applyModelSpecEphemeralAgent({
|
||||
convoId,
|
||||
modelSpec,
|
||||
updateEphemeralAgent,
|
||||
}: {
|
||||
convoId?: string | null;
|
||||
modelSpec?: t.TModelSpec;
|
||||
updateEphemeralAgent: ((convoId: string, agent: t.TEphemeralAgent | null) => void) | undefined;
|
||||
}) {
|
||||
if (!modelSpec || !updateEphemeralAgent) {
|
||||
return;
|
||||
}
|
||||
updateEphemeralAgent((convoId ?? Constants.NEW_CONVO) || Constants.NEW_CONVO, {
|
||||
mcp: modelSpec.mcpServers ?? [],
|
||||
web_search: modelSpec.webSearch ?? false,
|
||||
file_search: modelSpec.fileSearch ?? false,
|
||||
execute_code: modelSpec.executeCode ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets default model spec from config and user preferences.
|
||||
* Priority: admin default → last selected → first spec (when prioritize=true or modelSelect disabled).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue