From 211d071832efa2a565ea70d04a7fd1ba02dfacf0 Mon Sep 17 00:00:00 2001 From: Aman Kumar <72304680+Aman-14@users.noreply.github.com> Date: Tue, 16 Sep 2025 06:18:18 +0530 Subject: [PATCH] fix: handle empty string for CAPTAIN_OPEN_AI_ENDPOINT config (#12435) When CAPTAIN_OPEN_AI_ENDPOINT is set to empty string, use .presence to properly fall back to default OpenAI endpoint instead of creating malformed URLs. Fixes #12383 Co-authored-by: Pranav --- lib/integrations/openai_base_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/integrations/openai_base_service.rb b/lib/integrations/openai_base_service.rb index f06baf5b5..7b4a93f95 100644 --- a/lib/integrations/openai_base_service.rb +++ b/lib/integrations/openai_base_service.rb @@ -81,7 +81,7 @@ class Integrations::OpenaiBaseService end def api_url - endpoint = InstallationConfig.find_by(name: 'CAPTAIN_OPEN_AI_ENDPOINT')&.value || 'https://api.openai.com/' + endpoint = InstallationConfig.find_by(name: 'CAPTAIN_OPEN_AI_ENDPOINT')&.value.presence || 'https://api.openai.com/' endpoint = endpoint.chomp('/') "#{endpoint}/v1/chat/completions" end