π OpenHands: AI-Driven Development
Fix V0 Integrations (#12584)
Tim O'Farrella9bd3a70c992
diff --git a/enterprise/integrations/github/github_manager.py b/enterprise/integrations/github/github_manager.pyindex a535312894..32ea147dec 100644--- a/enterprise/integrations/github/github_manager.py+++ b/enterprise/integrations/github/github_manager.py@@ -33,6 +33,7 @@ from server.utils.conversation_callback_utils import register_callback_processorfrom openhands.core.logger import openhands_logger as loggerfrom openhands.integrations.provider import ProviderToken, ProviderType+from openhands.integrations.service_types import AuthenticationErrorfrom openhands.server.types import (LLMAuthenticationError,MissingSettingsError,@@ -348,7 +349,7 @@ class GithubManager(Manager):msg_info = f'@{user_info.username} please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'- except (ExpiredError, SessionExpiredError) as e:+ except (AuthenticationError, ExpiredError, SessionExpiredError) as e:logger.warning(f'[GitHub] Session expired for user {user_info.username}: {str(e)}')diff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex 10c81b9543..cbbac29c1e 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -136,7 +136,7 @@ class LLM(RetryMixin, DebugMixin):if self.config.model.startswith('openhands/'):model_name = self.config.model.removeprefix('openhands/')self.config.model = f'litellm_proxy/{model_name}'- self.config.base_url = 'https://llm-proxy.app.all-hands.dev/'+ self.config.base_url = _get_openhands_llm_base_url()logger.debug(f'Rewrote openhands/{model_name} to {self.config.model} with base URL {self.config.base_url}')@@ -851,3 +851,18 @@ class LLM(RetryMixin, DebugMixin):# let pydantic handle the serializationreturn [message.model_dump() for message in messages]+++def _get_openhands_llm_base_url():+ # Get the API url if specified+ lite_llm_api_url = os.getenv('LITE_LLM_API_URL')+ if lite_llm_api_url:+ return lite_llm_api_url++ # Fallback to using web_host.+ web_host = os.getenv('WEB_HOST')+ if web_host and ('.staging.' in web_host or web_host.startswith('staging')):+ return 'https://llm-proxy.staging.all-hands.dev/'++ # Use the default+ return 'https://llm-proxy.app.all-hands.dev/'