localhost base_url fixup when running in a docker container (#11474)

Co-authored-by: Rohit Malhotra <rohitvinodmalhotra@gmail.com>
This commit is contained in:
eddierichter-amd
2025-11-04 15:57:25 -07:00
committed by GitHub
parent 308d0e62ab
commit c544ea1187
6 changed files with 128 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ from openhands.resolver.patching import apply_diff, parse_patch
from openhands.resolver.resolver_output import ResolverOutput
from openhands.resolver.utils import identify_token
from openhands.utils.async_utils import GENERAL_TIMEOUT, call_async_from_sync
from openhands.utils.environment import get_effective_llm_base_url
def apply_patch(repo_dir: str, patch: str) -> None:
@@ -707,10 +708,16 @@ def main() -> None:
)
api_key = my_args.llm_api_key or os.environ['LLM_API_KEY']
model_name = my_args.llm_model or os.environ['LLM_MODEL']
base_url = my_args.llm_base_url or os.environ.get('LLM_BASE_URL')
resolved_base_url = get_effective_llm_base_url(
model_name,
base_url,
)
llm_config = LLMConfig(
model=my_args.llm_model or os.environ['LLM_MODEL'],
model=model_name,
api_key=SecretStr(api_key) if api_key else None,
base_url=my_args.llm_base_url or os.environ.get('LLM_BASE_URL', None),
base_url=resolved_base_url,
)
if not os.path.exists(my_args.output_dir):