#12158 Remove parameters from the UI in the "Parameters" side panel which are in dropParams#12160
Conversation
…tup Config, remove these params from the UI under "Parameters" side panel
…e and dropParams array. Remove dropParams from Param side panel
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #12158 by hiding parameters from the UI "Parameters" side panel when they are listed in dropParams for custom endpoints in the YAML configuration file. Previously, dropParams only affected the server-side API requests but the parameters still appeared in the UI, causing confusion.
Changes:
- Added a new
endpointsDropParamsMapfield toTStartupConfigthat maps custom endpoint names to theirdropParamsarrays - Built the endpoint-to-dropParams mapping on the server in the
/configroute and included it in the startup config response - Filtered out dropped parameters in the Parameters side panel component using the startup config data
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
packages/data-provider/src/config.ts |
Added endpointsDropParamsMap field to TStartupConfig type |
api/server/routes/config.js |
Added getEndpointsDropParamsMap function to extract dropParams from custom endpoints and included the result in the startup config payload |
client/src/components/SidePanel/Parameters/Panel.tsx |
Consumes the new endpointsDropParamsMap from startup config to filter out dropped parameters from the UI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if (endpoint && Array.isArray(endpoint.dropParams)) { | ||
| dropParams.push(...endpoint.dropParams); | ||
| if (dropParams.length > 0) { | ||
| result[endpoint.name] = dropParams; |
There was a problem hiding this comment.
The endpoint name should be normalized using normalizeEndpointName to match how endpoint names are stored elsewhere in the codebase (e.g., in loadCustomEndpointsConfig at packages/api/src/endpoints/custom/config.ts:39 and loadConfigModels at api/server/services/Config/loadConfigModels.js:65). Without normalization, if a user configures an endpoint named "Ollama", the key in this map would be "Ollama", but conversation.endpoint on the client side would be "ollama" (the normalized form), causing a lookup miss.
Additionally, normalizeEndpointName is already imported from librechat-data-provider and should be added to the import on line 4.
| let dropParams = []; | ||
| if (endpoint && Array.isArray(endpoint.dropParams)) { | ||
| dropParams.push(...endpoint.dropParams); | ||
| if (dropParams.length > 0) { | ||
| result[endpoint.name] = dropParams; | ||
| } | ||
| } |
There was a problem hiding this comment.
The intermediate dropParams array is unnecessary. The code creates an empty array, spreads endpoint.dropParams into it, then checks if it has length. Since endpoint.dropParams is already verified to be an array on line 44, you can simplify this to directly use endpoint.dropParams and check its length:
if (endpoint && Array.isArray(endpoint.dropParams) && endpoint.dropParams.length > 0) {
result[endpoint.name] = endpoint.dropParams;
}| /** @type {TStartupConfig} */ | ||
| const payload = { | ||
| appTitle: process.env.APP_TITLE || 'LibreChat', | ||
| endpointsDropParamsMap: endpointsDropParamsMap, |
There was a problem hiding this comment.
This file uses shorthand property notation for other variables with matching names (e.g., emailLoginEnabled on line 107, sharedLinksEnabled on line 125, passwordResetEnabled on line 115). For consistency, this should use shorthand: endpointsDropParamsMap, instead of endpointsDropParamsMap: endpointsDropParamsMap,.
|
|
||
| export type TStartupConfig = { | ||
| appTitle: string; | ||
| endpointsDropParamsMap?: Map<string, string []>; |
There was a problem hiding this comment.
The TypeScript type Map<string, string[]> is incorrect here. The server constructs this as a plain JavaScript object (const result = {}) which gets serialized to JSON. JSON does not support Map — a Map serialized to JSON becomes {}. On the client side, the code accesses this via bracket notation (startupConfig?.endpointsDropParamsMap?.[conversation?.endpoint ?? '']), which works for plain objects but not for Map instances.
This should be Record<string, string[]> instead of Map<string, string[]> to correctly represent the runtime type after JSON deserialization.
…tup Config, remove these params from the UI under "Parameters" side panel
Pull Request Template
Summary
PR to address #12158 - Remove parameters from the UI in the "Parameters" side panel which are in dropParams.
We want to have it where any param listed in the dropParam array in the configuration file, will be removd from the parameters side panel, so that it is not confusing to the end user.
We add a variable to the stratUpConfig which is a Map, mapping custom endpoint names to the array of dropParams. These are then filtered out in Parameters/Panel.tsx
Change Type
Please delete any irrelevant options.
Testing
Configure enpoints that have dropParams in the yaml config file. Run LibreChat and ensure those Parameters are removed from Param Side Panel
Test Configuration:
Checklist
Please delete any irrelevant options.