🔧 refactor: Display name logic in Parallel Responses (#11149)

- Removed the use of `getResponseSender` for computing display names in both `Agent.js` and `loadAddedAgent.js`.
- Implemented fallback logic to derive display names from `modelLabel`, `modelSpec.label`, and `endpointConfig.modelDisplayLabel`.
- Enhanced comments for clarity on the new display name resolution process.
- Updated `useChatFunctions` and `createDualMessageContent` to accommodate changes in sender logic, ensuring consistent handling of ephemeral agents across the application.
This commit is contained in:
Danny Avila 2025-12-29 21:42:21 -05:00 committed by GitHub
parent c7469ce884
commit dcda6a249c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 29 deletions

View file

@ -8,7 +8,6 @@ const {
ResourceType,
actionDelimiter,
isAgentsEndpoint,
getResponseSender,
isEphemeralAgentId,
encodeEphemeralAgentId,
} = require('librechat-data-provider');
@ -150,7 +149,7 @@ const loadEphemeralAgent = async ({ req, spec, endpoint, model_parameters: _m })
const instructions = req.body.promptPrefix;
// Compute display name using getResponseSender (same logic used for addedConvo agents)
// Get endpoint config for modelDisplayLabel fallback
const appConfig = req.config;
let endpointConfig = appConfig?.endpoints?.[endpoint];
if (!isAgentsEndpoint(endpoint) && !endpointConfig) {
@ -161,10 +160,10 @@ const loadEphemeralAgent = async ({ req, spec, endpoint, model_parameters: _m })
}
}
const sender = getResponseSender({
modelLabel: model_parameters?.modelLabel,
modelDisplayLabel: endpointConfig?.modelDisplayLabel,
});
// For ephemeral agents, use modelLabel if provided, then model spec's label,
// then modelDisplayLabel from endpoint config, otherwise empty string to show model name
const sender =
model_parameters?.modelLabel ?? modelSpec?.label ?? endpointConfig?.modelDisplayLabel ?? '';
// Encode ephemeral agent ID with endpoint, model, and computed sender for display
const ephemeralId = encodeEphemeralAgentId({ endpoint, model, sender });