mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
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 <pranav@chatwoot.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user