fix: fix proxy setup (#227)

* fix: fix proxy setup

* feat&fix: add proxy support in setup and remove hardcoded proxy from example
This commit is contained in:
Zilong Zhou
2025-07-02 01:36:32 +08:00
committed by GitHub
parent d4273d992e
commit 595a704aff
4 changed files with 42 additions and 22 deletions

View File

@@ -215,10 +215,13 @@ class DesktopEnv(gym.Env):
logger.info("Environment is clean, skipping snapshot revert (provider: {}).".format(self.provider_name))
if task_config is not None:
if task_config.get("proxy", False) and self.enable_proxy:
# If using proxy and proxy is enabled, set up the proxy configuration
self.setup_controller._proxy_setup()
self._set_task_info(task_config)
self.setup_controller.reset_cache_dir(self.cache_dir)
logger.info("Setting up environment...")
success = self.setup_controller.setup(self.config)
success = self.setup_controller.setup(self.config, task_config.get("proxy", False) and self.enable_proxy)
if success:
# Mark environment as used when setup is successfully executed
if self.config: # Only mark as used if there were actual setup operations
@@ -235,10 +238,6 @@ class DesktopEnv(gym.Env):
break
logger.info("Environment setup complete.")
if task_config.get("proxy", False) and self.enable_proxy:
# If using proxy and proxy is enabled, set up the proxy configuration
self.setup_controller._proxy_setup()
observation = self._get_obs()
return observation