Merge pull request #1791 from arc53/fix-openai-conflict

fix for OPENAI_BASE_URL + ollama can't connect to container
This commit is contained in:
Alex
2025-05-15 19:04:21 +03:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -13,10 +13,11 @@ class OpenAILLM(BaseLLM):
from openai import OpenAI
super().__init__(*args, **kwargs)
if settings.OPENAI_BASE_URL:
if isinstance(settings.OPENAI_BASE_URL, str) and settings.OPENAI_BASE_URL.strip():
self.client = OpenAI(api_key=api_key, base_url=settings.OPENAI_BASE_URL)
else:
self.client = OpenAI(api_key=api_key)
DEFAULT_OPENAI_API_BASE = "https://api.openai.com/v1"
self.client = OpenAI(api_key=api_key, base_url=DEFAULT_OPENAI_API_BASE)
self.api_key = api_key
self.user_api_key = user_api_key
self.storage = StorageCreator.get_storage()