From 93dd365fdab6dc3030bfbb4271396dd02700e486 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sun, 16 Feb 2025 10:52:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20Add=20Null=20Checks=20for?= =?UTF-8?q?=20BaseURL=20in=20Agent=20Config=20(#5908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/server/controllers/agents/run.js | 2 +- api/server/services/Endpoints/openAI/llm.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/server/controllers/agents/run.js b/api/server/controllers/agents/run.js index 346b9e6df..6c98a641d 100644 --- a/api/server/controllers/agents/run.js +++ b/api/server/controllers/agents/run.js @@ -45,7 +45,7 @@ async function createRun({ /** @type {'reasoning_content' | 'reasoning'} */ let reasoningKey; - if (llmConfig.configuration?.baseURL.includes(KnownEndpoints.openrouter)) { + if (llmConfig.configuration?.baseURL?.includes(KnownEndpoints.openrouter)) { reasoningKey = 'reasoning'; } if (/o1(?!-(?:mini|preview)).*$/.test(llmConfig.model)) { diff --git a/api/server/services/Endpoints/openAI/llm.js b/api/server/services/Endpoints/openAI/llm.js index 05b08b284..c12f835f2 100644 --- a/api/server/services/Endpoints/openAI/llm.js +++ b/api/server/services/Endpoints/openAI/llm.js @@ -58,7 +58,7 @@ function getLLMConfig(apiKey, options = {}) { /** @type {OpenAIClientOptions['configuration']} */ const configOptions = {}; - if (useOpenRouter || reverseProxyUrl.includes(KnownEndpoints.openrouter)) { + if (useOpenRouter || (reverseProxyUrl && reverseProxyUrl.includes(KnownEndpoints.openrouter))) { llmConfig.include_reasoning = true; configOptions.baseURL = reverseProxyUrl; configOptions.defaultHeaders = Object.assign(