mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 fix: Express v5 Optional chaining for endpoint retrieval in Assistants Controllers (#10946)
- Updated endpoint retrieval logic in `helpers.js` and `v1.js` to use optional chaining for safer access to request body and query parameters, enhancing code robustness.
This commit is contained in:
parent
e15d37b399
commit
959e301f99
2 changed files with 2 additions and 2 deletions
|
|
@ -185,7 +185,7 @@ const listAssistantsForAzure = async ({ req, res, version, azureConfig = {}, que
|
|||
* @returns {Promise<{ openai: OpenAI, openAIApiKey: string }>} - The initialized OpenAI SDK client.
|
||||
*/
|
||||
async function getOpenAIClient({ req, res, endpointOption, initAppClient, overrideEndpoint }) {
|
||||
let endpoint = overrideEndpoint ?? req.body.endpoint ?? req.query.endpoint;
|
||||
let endpoint = overrideEndpoint ?? req.body?.endpoint ?? req.query?.endpoint;
|
||||
const version = await getCurrentVersion(req, endpoint);
|
||||
if (!endpoint) {
|
||||
throw new Error(`[${req.baseUrl}] Endpoint is required`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue